3 ms·
Worth being aware that deeply nested trees are quite inefficient on modern hardware, where CPUs can execute many instructions in the time it takes for a single
by rictic 3y ago
Worth being aware that deeply nested trees are quite inefficient on modern hardware, where CPUs can execute many instructions in the time it takes for a single cache miss. There are techniques to ameliorate this somewhat, e.g. B-trees, but from a quick skim of pygtree it looks like it doesn't use them. You may get a spaghetti of nodes and pointers spread unpredictably over the heap.
It's easy to end up writing code that's got good algorithmic time complexity, but where the CPU spends its time sitting cold and waiting on RAM.
- nico 3y ago> It's easy to end up writing code that's got good algorithmic time complexity, but where the CPU spends its time sitting cold and waiting on RAM It’s been interesting preparing for coding interviews. Quite a few times, the “optimal” solution time-complexity wise, is slower than the brute force solution Many of those it’s because of the inputs. If you know what they are or what their order distribution is going to be, you can usually do quite a lot better than the naive “ideal” solution