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
Is your feature request related to a problem? Please describe.
useWith is slower then just setting the it object to globalThis in the actual file.
Describe the solution you'd like
I am confused as to why, I used Object.entries(it).forEach(([key, value]) => globalThis[key] = value) in the template file and it was actually faster then using the useWith setting (in my testing)
Additional context
Will add tommorow, did some performance testing.
The text was updated successfully, but these errors were encountered:
That's fascinating! To be honest, I'm not surprised -- useWith has been recommended against for a while, so it's likely not optimized by most common JS runtimes.
Yeah seems like with() is always the slowest at first but gets faster overtime when it is run multiple times but is still slower then globalThis.
(This is not accurate):
with() 0.007s
globalThis 0.0004s
You can just set it up using functionHeader: 'Object.entries(Object.assign({},it)||{}).forEach(([k,v])=>globalThis[k]=v)' (Not using {...} spread as I believe it is slightly slower.
I could probably implement this directly but not sure if you want that. You should probably test it yourself.
Is your feature request related to a problem? Please describe.
useWith is slower then just setting the it object to globalThis in the actual file.
Describe the solution you'd like
I am confused as to why, I used
Object.entries(it).forEach(([key, value]) => globalThis[key] = value)
in the template file and it was actually faster then using the useWith setting (in my testing)Additional context
Will add tommorow, did some performance testing.
The text was updated successfully, but these errors were encountered: