olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.96k stars 548 forks source link

small optimization #145

Closed Fil closed 9 years ago

benpickles commented 9 years ago

It would be really valuable to have some sort of standard benchmark script. Would be useful for this pull request, #105, and #142.

olivernn commented 9 years ago

They're far from perfect but there are a few perf tests in the repo http://lunrjs.com/perf/ source is here https://github.com/olivernn/lunr.js/tree/master/perf

For this change I put together a very simple js perf test https://jsperf.com/lunr-midpoint-test

It seems that in everything but safari there isn't much difference

olivernn commented 9 years ago

Since there isn't much difference I'm going to stick with using Math.floor I think it is more intention revealing than resorting to bit fiddling in this case.