2 ms·
I’ve always considered this a bit of an academic conversation because as others have people have pointed out the up front costs are often too much to bear. Howe
by hinkley 1y ago
I’ve always considered this a bit of an academic conversation because as others have people have pointed out the up front costs are often too much to bear. However we have languages now that can run functions at build time. So a static lookup table is possible.
And where else would one use a static lookup table to great effect? When I actively followed the SIGPLAN (programming languages) proceedings, one of the papers that really stood out for me was one about making interface/trait based function calls as fast as inheritance by using perfect hashing on all vtable entries.
- bytehamster 1y agoThat sounds super interesting! Do you remember the title or the authors of the paper?
- anitil 1y agoI've seen these used in compilers for matching keywords - it's usually a small list of words but used so often in tokenising that it can be worth the bother. I've used gperf to (unsuccessfully) improve a key dictionary in python, but it turns out the default dictionary implementation is pretty good so the extra hassle wasn't worth the bother.