The existing implementation is occasionally fooled by small numbers. I have an alternate implementation that I'm trying out to see if it gets fooled less often.
Created attachment 321139 [details] [diff] [review] v1
Interesting and simpler approach. I would like to try it out when I can, but I like it.
The BigO function was removed from shell.js in https://hg.mozilla.org/mozilla-central/rev/d3ab52f7cf76