Optimizing for JavaScript is hard

In my quest for making Elm faster, I have found that optimizing for JavaScript is surprisingly hard. So I wrote a blog post about it. Hope you’ll like it :slight_smile:


Interesting blog post!

Regarding code getting deoptimized because the record field order changed: would something like this NoUnsortedRecords - elm-review-no-unsorted 1.1.2 prevent that from happening? In other words, a rule that ensures that the record fields are always in a certain order.

The elm compiler sorts the fields alphabetically in the generated JS. No need to worry about this JS detail in Elm code!

The current record update function also preserves the field order in JS.


Exactly, the compiler already does this, which is I believe one of the reasons that Elm code is often faster than manually-written JavaScript.

And my experiment destroyed this nice optimization :upside_down_face:


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.