You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
While working on #109 I noticed the compiled function's source was pretty winded for longer paths and was curious if it could be made less verbose. I was also curious how much faster it was than the prototype non-evald version. So... I put together a benchmark comparing 6 different things:
Looping over an array of keys to traverse using ["1.2"] syntax for float-looking keys
Doing the same but using [1.2] syntax for float-looking keys
Compling as is with long if conditions using ["1.2"] syntax for float-looking keys
Doing the same but using [1.2] syntax for float-looking keys
obj = obj.foo; (hardcoded), if obj is null then returning defaultValue, move to the next key obj = obj.bar, repeat (using ["1.2"] syntax for float-looking keys)
Doing the same but using [1.2] syntax for float-looking keys
Findings:
Reusing a local variable either performed the same or substantially beat the current methodology.
Using a floating index for a key which would otherwise be a string either tanked performance or had no effect (Firefox)
Example of something generated/compiled with current methodology:
Awesome findings (yet again)! Yeah, the current pattern also has the disadvantage of being O(D^2) where D is the depth of the path, vs O(D) in your "fastest" version.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
While working on #109 I noticed the compiled function's source was pretty winded for longer paths and was curious if it could be made less verbose. I was also curious how much faster it was than the
prototype
non-eval
d version. So... I put together a benchmark comparing 6 different things:["1.2"]
syntax for float-looking keys[1.2]
syntax for float-looking keysif
conditions using["1.2"]
syntax for float-looking keys[1.2]
syntax for float-looking keysobj = obj.foo;
(hardcoded), ifobj
isnull
then returningdefaultValue
, move to the next keyobj = obj.bar
, repeat (using["1.2"]
syntax for float-looking keys)[1.2]
syntax for float-looking keysFindings:
Example of something generated/compiled with current methodology:
Example of highest performing generated/compiled function:
Notes:
The text was updated successfully, but these errors were encountered: