3 ms·
I guess my time doing low latency work and rust programming makes me see those numbers and want to shave that time off since it’s inside a protocol which you ex
by fnordpiglet 3y ago
I guess my time doing low latency work and rust programming makes me see those numbers and want to shave that time off since it’s inside a protocol which you expect to be called millions of times in tight succession potentially dominating the machines performance on a front end node doing nothing but shuttling data. Definitely there will be a lot of other stuff contributing surrounding - but a march of a million miles starts with a single step ;-) certainly in a higher level business logic world I could see not squeezing every cpu cycle and optimizing for clarity of reading, but at very low levels of tight loops (at least in my world) time spent here is time not spent on stuff the developer cares about :-)
- norir 3y agoYeah, I don't really understand why they didn't just comment out the high level function call (option 3) and inline option 4 below. Then they could have clarity and performance.
- gmac 3y agoSure, that was also an option. Feel free to submit another PR to the maintainers!
- tleb_ 3y agoWhat is being talked about is a single 16-bit write inside a byte buffer. The benchmark delta is 10ns per request (90ns for bit-twiddling vs 100ns for writeUInt16BE). 90ns/100ns is a lot for this kind of operation, but that comes from JS' handling of numbers and not a badly optimised routine.