3 ms·
> But, life is never this easy. Your code may not be very profilable. This was the case with my mysql 0.9.6 library. My parser was basically one big function wi
by masklinn 14y ago
> But, life is never this easy. Your code may not be very profilable. This was the case with my mysql 0.9.6 library. My parser was basically one big function with a huge switch statement. I thought this was a good idea because this is how Ryan's http parser for node looks like and being a user of node, I have a strong track record for joining cargo cults. Anyway, the big switch statement meant that the profiler output was useless for me, "Parser#parse" was all it told me about : (.
FWIW this is also a case of "get better tools". Line profilers exist, and they can handle that kind of cases (though the instrumentation costs go up likewise).
- netghost 14y agoFor Node and V8? I'm sure you're right, but when I was poking around I didn't see much more than suggestions to use "node --prof". Which tools have you found useful?
- masklinn 14y ago> For Node and V8? I don't know, I use neither. I'm just saying, there are profiling tools which handle the "One Big Function" pattern.