# Performance debugging helper

**URL:** <https://discourse.elm-lang.org/t/performance-debugging-helper/6122>\
**Category:** Show and Tell\
**Created:** [August 3, 2020, 7:33am UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122 "2020-08-03T07:33:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![janjelinek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/janjelinek/32/4010_2.png) [@janjelinek](https://discourse.elm-lang.org/u/janjelinek)\
**Post date:** [August 3, 2020, 7:33am UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/1 "2020-08-03T07:33:23Z")

</div>

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](https://github.com/janjelinek/elm-performance-debugging/blob/master/README.md)

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

---

<div class="post-metadata">

**Author:** ![berend](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/berend/32/2250_2.png) [@berend](https://discourse.elm-lang.org/u/berend)\
**Post date:** [August 3, 2020, 7:40am UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/2 "2020-08-03T07:40:53Z")

</div>

Spell “ged” as “get”!

---

<div class="post-metadata">

**Author:** ![berend](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/berend/32/2250_2.png) [@berend](https://discourse.elm-lang.org/u/berend)\
**Post date:** [August 3, 2020, 7:41am UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/3 "2020-08-03T07:41:55Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Janiczek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/janiczek/32/4516_2.png) [@Janiczek](https://discourse.elm-lang.org/u/Janiczek)\
**Post date:** [August 3, 2020, 8:07am UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/4 "2020-08-03T08:07:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![janjelinek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/janjelinek/32/4010_2.png) [@janjelinek](https://discourse.elm-lang.org/u/janjelinek)\
**Post date:** [August 3, 2020, 8:55am UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/5 "2020-08-03T08:55:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gampleman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/gampleman/32/43_2.png) [@gampleman](https://discourse.elm-lang.org/u/gampleman)\
**Post date:** [August 3, 2020, 1:29pm UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/6 "2020-08-03T13:29:38Z")

</div>

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](https://github.com/elm/compiler/issues/2129)

---

<div class="post-metadata">

**Author:** ![janjelinek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/janjelinek/32/4010_2.png) [@janjelinek](https://discourse.elm-lang.org/u/janjelinek)\
**Post date:** [August 3, 2020, 3:42pm UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/7 "2020-08-03T15:42:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [August 13, 2020, 3:43pm UTC](https://discourse.elm-lang.org/t/performance-debugging-helper/6122/8 "2020-08-13T15:43:00Z")

</div>

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