3 ms·
The level of bikeshedded micro-optimization going on in that file is hilarious. The whole thing could be swapped out with a Ragel parser and nobody would notice
by hosay123 13y ago
The level of bikeshedded micro-optimization going on in that file is hilarious. The whole thing could be swapped out with a Ragel parser and nobody would notice a thing
- mikeash 13y agoThe code is totally wrong, but it least it generates the wrong answer very quickly....
- asveikau 13y agoThere is no sense waiting for strncmp. The only logical solution is to replace it with 8 macros. Anyone looking to purchase a souped up Honda Civic?
- masklinn 13y ago> The whole thing could be swapped out with a Ragel parser and nobody would notice a thing People might notice that it now works correctly. And it might even be faster.
- jacobr 13y ago> To make a long story short: very old versions of http_parser were based on a Ragel grammar but the handwritten version outperformed it by a significant margin, as in over 10% fewer branches taken. > Ragel is great but it can't take shortcuts like a human programmer can and once you start jumping around in your grammar, things become complicated fast (and impossible to debug.) https://github.com/joyent/http-parser/pull/156#issuecomment-22933119 https://github.com/joyent/http-parser/pull/156#issuecomment-...
- Filligree 13y agoSo yeah, at least they get the wrong answer quickly.
- peterwwillis 13y agoThis is not optimization or bikeshedding. Optimization is not supposed to break things, it's supposed to make things more efficient. I don't see any examples of bikeshedding either (this is just code; where's the dispute?). This is a broken implementation of a protocol.
- general_failure 13y agoHuh? Nobody has noticed anything even without replacing it. So, the existing code is just fine.