cssinjs / istf-spec

Interoperable Style Transfer Format [DRAFT]
247 stars 8 forks source link

Optimization using JSON.parse #31

Open kof opened 7 years ago

kof commented 7 years ago

Today I read a blogpost by @tomdale. It states that JSON.parse is faster by 18x than eval. When we evaluate our script with ISTF, it is basically an eval I assume.

As in our format, the only pure JS part is functions, we can put them into a separate array, stringify everything else and JSON.parse at runtime. Lets see if this can yeld any reasonable perf improvements for us.

Alternatively we can also try Array#join and Array#split, as we have no objects.

Also see #22 and #19