css-in-js-utils icon indicating copy to clipboard operation
css-in-js-utils copied to clipboard

improve object iteration

Open veksa opened this issue 1 year ago • 4 comments

Based on the benchmark (https://jsben.ch/kxBxv), the "for in" loop appears to be 10% slower than the "for" loop.

This pull request optimizes object traversal loops. Also ESLint errors fixed.

veksa avatar Dec 04 '23 10:12 veksa

Screenshot 2023-12-04 at 13 00 03

I get some very different results, so I'm rather hesitant to change any of those right now.

robinweser avatar Dec 04 '23 12:12 robinweser

i created a benchmark on another platform, https://jsbench.me/a4lpr3txxo/1 also tested it on Win11 and Mac. could you please check it

veksa avatar Dec 04 '23 16:12 veksa

I get the same results over there. I think it's more about browser differences than the actual benchmark. I use Safari, most likely different in Firefox and/or Chrome.

robinweser avatar Dec 04 '23 16:12 robinweser

yeah, checked it on M1 in Safari. It seems faster, will investigate further into this.

veksa avatar Dec 05 '23 07:12 veksa