I am currently doing Advent Of Code (definately to recommend btw but off topic. However on Day 3 I was pretty unhappy with the performance of my algorithm.
So I started using the built in node profiler to test out where I am wasting time. Here's the link to the repo in case you want to reproduce my steps advent-of-code-2019-typescript. Also if you do run
npm install
npm run build
before running the profiler
Steps to reproduce
I was following the guide from node.js to analyze my code. So first i ran my Code for Day 3 with the profiler
node --prof ./dist/src/03.01/index.js
node --prof-process isolate-xxxxxx-v8.log > processed.txt
Now the Output is not really helping
processed.txt [Summary-Section]
[Summary]:
ticks total nonlib name
12 0.0% 70.6% JavaScript
0 0.0% 0.0% C++
344 0.6% 2023.5% GC
56103 100.0% Shared libraries
5 0.0% Unaccounted
As you see practicaly all ticks show up under Shared libraries. My guess is that this happens because index.js imports all the functions it needs and executes them. Practically everything should turn up under JavaScript yet only 12 ticks do.
If I am correct and this is the reason my question would be
How can i resolve the Shared Libaries Section to actually show all the functions being called and their ticks?
Bonus-Question
I would be happy if my question above was answered but this would help me further. I use TypeScript, so the Profiler runs on the transpiled Code. As a result my functions show up as and i would have to check in the transpiled code with line refers to which function. Possible but not pretty.
Is there a way to map this to the typescript files?