I'm trying to think the best solution for a NodeJS library I've been writting in the last year. In this project, performance definitively matters. The current performance is good (we've been able to reduce our response times in a 30%) but I'm trying to find ways to make a better library.
After some research, I realized that I use Array.map in some critical functions. Since Array.map has to check for possible empty values, it has to be slower than any function that does the same without performing that check. I wanted to know how slow is Array.map, so I wrote a benchmark and run it with the latest version of Google Chrome.
I expected Array.map to be slow, but not as much! Array.map seems to be 90% slower than other equivalent codes. So now I have a problem.
I'd love to get that extra performance for free and I would probably reduce the response time in 1ms, but in the other hand the real bottleneck is in some data provider's response times and I'm depending on benchmarks that could change in new V8 releases.
What should I do? I know I'm taking too much time in a micro optimization, but I feel I can learn an important lesson that could be extrapolated to many similar problems.