4 ms·
Ages ago I had a conversation with a coworker about why was it that if databases collect statistics for optimizations, that data structures in programming langu
by hinkley 6y ago
Ages ago I had a conversation with a coworker about why was it that if databases collect statistics for optimizations, that data structures in programming languages don't do the same thing?
This would come up a few more times in my career. The next time was a few years later when I was having to go through a code base removing premature optimizations for initial list size in a code base. The average length of our data had grown such that our lists were now bigger than the defaults would have been. That was added to my growing collection of "making code faster by removing code" examples.
We talk about using better algorithms instead of tweaking code with micro-optimizations but then we never talk about tuning the better algorithms. So they default to the average case or worse.
- The_rationalist 6y agoI had seen such a statistically fine tuned data structure on github.com some time ago but can't find it. I wonder if in memory representations for compute such as apache arrow exploit this
- tjalfi 6y ago> Ages ago I had a conversation with a coworker about why was it that if databases collect statistics for optimizations, that data structures in programming languages don't do the same thing? Lus tables in LuaJIT, Hack arrays, and JavaScript arrays can use different representations depending on what is stored in them. NYU’s SETL project also did some work on automatically identifying what data structure should be used. IBM’s Hermes project was also working on this; I’m not sure whether they shipped it.