lukeed/mri

Add getopts benchmark

jsumners opened this issue ยท 4 comments

https://www.npmjs.com/package/getopts is another package like this one with a primary claim to speed.

I just tried this locally and it looks like getopts wins.

image

Running on:
image

Ah, nice. Thanks guys โ€“ didn't know about these two ๐Ÿ‘

I may revisit this module in the future, it was written well over a year ago & with a quick glance over mri source, there are definitely some wins to be had.

I'll add it to my backlog for a weekend project or something.. but mri isn't claiming to be the fastest so I don't think there's a big rush. Plus, after a certain threshold, additional speed doesn't really matter anymore ๐Ÿ˜† But yargs & minimist were noticeably/too slow at the time.

@enriched Not sure where you got that benchmark, but you may want to randomize the order there. The JIT will be warmed/hotter as the tests continue, and since most of these (probably) do the same things, the ones that run last will be abnormally faster. AKA, there's no way I would have allowed a performance drop on mri from 685k to 476k ๐Ÿ˜‰

If/when I revisit this package, I'll expand the benchmarks. Thanks!

@lukeed, I just pulled this repo and ran the stuff in the bench folder. Then added a couple of the other arg parsers because I was curious. I didn't do much reading about what is happening in there or the best practices for the benchmark library, so I totally might have not followed best practices on that ๐Ÿ˜ณ

I'm sure it's fine :) I'm just saying that items that run last (and closer to) generally receive a bit of a performance boost. Applies to nearly all benchmarks, not just here ๐Ÿ‘