Micro-optimize action binding by preallocating arguments array#179
Micro-optimize action binding by preallocating arguments array#179aduth wants to merge 2 commits intodevelopit:masterfrom aduth:update/action-bind-perf
Conversation
|
I managed to reclaim a few bytes in 5f4fbdb by switching to a while loop.
I tried a few other ideas (unsuccessfully) as well:
let args = [ state ];
args.length = arguments.length;This regressed on the benchmarked gains. I assume it's because the benefit comes from the constructor of an array with length.
Interestingly, this uses 2 fewer characters before gzip, but ultimately results in a larger gzipped bundle size (diff). |
|
@aduth hello stranger. i opened a couple of pull requests with rather substantial changes that i personally think greatly improves unistore and was looking for some feedback on. i'm assuming @developit is busy and meanwhile i was hoping to get this feedback from elsewhere. since you have opened a pull request yourself i assume you are familiar with the package and would love to hear what you think about the changes i propose. you can find them at #182 and #183. the second one builds upon the changes from the first. |
It doesn't seem I can easily edit or fork the referenced benchmark, but in the latest Chrome (78), this appears to perform slightly better than the current implementation:
Benchmark details
Setup:Test:
It's a technique we use in our state library's selector binding.
The size bump is bigger than expected, not significant, but enough to fail tests without adjusting the permitted bundle size.