Carp icon indicating copy to clipboard operation
Carp copied to clipboard

Profiling the compiler

Open eriksvedang opened this issue 4 years ago • 4 comments

So far very little work has gone into making the compiler fast. For the most parts I thinks it's "fast enough", but since there presumably are no big projects written in Carp this is hard to know for sure. I think that profiling the compiler to at least know what parts are slow could be an interesting and worthwhile endeavour. This issue can be a good place for reporting the results and discussing possible improvements.

eriksvedang avatar May 11 '20 08:05 eriksvedang

A good example for the compiler being mysteriously slow (at least on my machine) is tests/map.carp. That test takes almost 20 seconds to compile.

hellerve avatar May 11 '20 09:05 hellerve

#795 attaches a flamegraph for that same file. Looks like toC and multiLookupInternal are good candidates.

jacereda avatar May 12 '20 22:05 jacereda

Also, flamegraph.sh shows that carp takes almost the same time as clang.

jacereda avatar May 12 '20 22:05 jacereda

When I rewrote the env code recently, the biggest hotspots were in exhaustive env lookups (looking for some binder in all parents, used modules, etc.) and emit.hs. This likely hasn't changed. After we do a bit more general clean up and push some fixes for outstanding bugs we can try and tackle this.

scolsen avatar Jun 01 '21 19:06 scolsen