Performance debugging helper

Let me share our experience with performance optimisation of our Elm app and looking for bottle necks. Usually is good to use browsers dev tools for performance profiling. At least we did it, but it’s not easier to follow compiled Elm code even if you do not have minified it.
So for our development purposes I made few simple regex which could help us to easier identify which function call is responsive for slowness.

Here you can find all details https://github.com/janjelinek/elm-performance-debugging/blob/master/README.md

Nothing fancy, but maybe it can make someone’s live easier.

6 Likes

Spell “ged” as “get”!

1 Like

And I see “replacemend” in the code, that should be “replacement”.

In English the “d” and “t” are pronounced very differently.

1 Like

To help give some context to this, the script by @janjelinek replaces a good chunk of your (anonymous) functions with a named variant. Particularly around F2,F3,… and A2,A3,… functions. So, the Chrome devtools (Performance tab) become more useful to Elm developers with this postprocessing step applied.

Yep, me and grammar. I’m usually to lazy for self-review texts before sending them out :slight_smile:

Actually I wonder if this wouldn’t be a useful thing for the Elm Compiler to emit when in dev mode by default. It’s fairly unlikely that we will get better profiling tools native to Elm anytime soon.

EDIT: https://github.com/elm/compiler/issues/2129

1 Like

To have named anonymous functions natively in compiler would be cool, but I also don’t believe it happen anytime soon. That’s why I decided to come up with this simple solution. It’s not 100% bulletproof but it’s working on our huge Elm codebase without any issues so far. I believe It can be even improved to be able cover almost all anonymous functions but this was quick win without too much complexity.

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