139 karma · joined April 27, 2022
1) at/around powers of two
2) regardless whether using GC or preallocating
makes me think its got to do with cache sizes. For example, the M2 macbook has around 16MiB of cache, which gives you approximately 2 million ~ 2^20 nodes where each node has a 64 bit number and a 64 bit pointer.The jumps in your measurements could be related to the cache hierarchy. On Linux (probably macOS too) you should be able to run "perf stat ./mergesort" to show you the hitrate of your CPU's caches.
I'd be interested in a follow-up post :)
You gain: Model consistency guaranteed by the database, your backend basically only acts as an external API for the database.
You lose: Modularity, makes it harder to swap out databases. Also, you have to write SQL for business logic which many developers are bad at or dislike or both.
I've seen a system running on this approach for ten years and it survived three generations of developers programming against this API. There's Python wx frontends, web frontends, Rust software, Java software, C software, etc. They all use the same database procedures for manipulating the model so it stays consistent. Postgres is (kinda, not very) heavy for small projects but it scales for medium up to large-ish projects (where it still scales but not as trivially). One downside I've seen in this project is that some developers were afraid to change the SQL procedures so they started to work around them instead of adding new ones or changing the existing ones. So in addition to your regular work horse programming language you also have to be pretty good at SQL.
The Go version may contain some typo or other that simply sets result to the empty list.
I'd argue that having idioms like list comprehension allows you to skim code faster, because you can skip over them (ah! we're simply shrinking foo a bit) instead of having to make sure that the loop doesn't do anything but append.
This even goes both ways: do-notation in Haskell can make code harder to skim because you have to consider what monad you're currently in as it reassigns the meaning of "<-" (I say this as a big Haskell fan).
At the same time I've seen too much Go code that does err != nil style checking and misses a break or return statement afterwards :(
ISBN is 3423300175.
> Currently, only NVIDIA v100 GPU simulation is supported, and all GPUs mentioned later in this post are simulated v100s.
So unless they can reproduce this on a real cluster cluster of V100s, it should probably be taken with a grain of salt. What I'm missing in the simulation is an accurate account of how the host-device barrier is sped up using this system. Reading the headline I was hoping they'd be using NVIDIA GPUDirect for accessing the storage directly from the devices but I believe you'd need very custom CUDA for that...
> part of population with lower than average IQ (which by definition is half of mankind)
Sounds like us-vs-them mentality to me honestly.
-- Before
captureAudioDuration :: DeviceID -> DiffTime -> IO WaveData
-- After
captureAudioDuration' :: MonadIO m => DeviceID -> DiffTime -> m WaveData
You can build the same thing, but for logging! class Monad m => MonadLog m where
log :: String -> m ()
-- In IO, just log to stdout.
-- Other implementations might be a state/writer monad
-- or a library/application-specific monad for business logic.
instance MonadLog IO where
log msg = putStrLn ("log: " ++ msg)
-- Before: Bad, doesn't actually do any IO but logging
findShortestPath :: Node -> Node -> Graph -> IO [Node]
-- After: Better, type signature gives us more details on what's happening.
-- We can still use this in an IO context because IO has a MonadLog instance.
-- However, trying to capture audio in this function using either
-- of the functions above will lead to a type error.
findShortestPath' :: MonadLog m => Node -> Node -> Graph -> m [Node]
As you can imagine this can get quite verbose and there's other patterns one can use. Feel free to ask any follow-up questions :)No. Your head is not covered by the GDPR. It requires you to not keep a record of all your clients' personal info without a legitimate interest.
There's a Seinfeld episode where Elaine goes to buy a fancy pen at a stationery store which isn't available atm. The clerk asks for her full name and number to notify her (that's a legitimate interest) but then uses it to hit on/stalk her (that would be a GDPR violation). Presumably he also doesn't get rid of the number after their business transaction.
As mentioned elsewhere in this thread, the peak production makes German electricity cheap enough to make everyone around them use it when it's available. If all the neighbors used this approach too, over the course of a day it would be everybody's turn to provide energy for the neighbors as renewables production will never be zero globally.
There's enough countries out there that have been using renewables consistently for years (esp. EU countries). I don't understand how this is still a talking point. Daily variance in supply is equalized by trading energy with your neighbors which uses the phenomenon described above: The sun is always shining somewhere.
For Germany in particular it was a mistake to move away from nuclear before coal (imo lobbying is mostly at fault here) but they've been building renewables since the late nineties. It took them the time it takes to build a single nuclear reactor to move to more than 50% renewables and those are much easier (= cheaper) to maintain for the years to come.
Using cash, we only spend 70% of what we spend using electronic payments
and the other one was privacy-related. I agree with both of them and your comment that it's easier to keep track of your expenses with cash.