Profiler

0 views
Skip to first unread message

Lehni

unread,
Apr 14, 2010, 9:59:26 AM4/14/10
to RingoJS
Hello,

I am encountering an issue with the profiler in Helma, and as I
believe the two projects share the code for profiling and RingoJS
receives more attention I am posting about it here.

The problem I encounter has to do with recursion. When I have a
function that recursively calls itself, its runtime is added up so the
time spent inside the function ends up being counted more than once
(as many times as the function was called within the first call). The
result is that I get functions / frames that list a total time of more
than the actual execution time of the request, in my case sometimes 5
- 10 times the amount, so it is rather confusion to make something of
these values.

I am happy to fix this but wonder what the expected behaviour should
be?

Hannes Wallnoefer

unread,
Apr 14, 2010, 9:18:46 PM4/14/10
to RingoJS
Hi Jürg,

The answer is to add profiling for self-time, which means only timing
instructions executed within one method, but not other methods called
from there. I guess we really want to do this in Java then instead of
JS as it adds quite a bit more overhead than plain method timing.

I think I'll eventually implement this, but don't expect me to back-
port this to Helma. You should really start using Ringojs, by the way!

Hannes

Hannes Wallnoefer

unread,
Apr 14, 2010, 9:33:36 PM4/14/10
to RingoJS

Wait, I actually implemented self-timing a long time ago.

http://github.com/ringo/ringojs/commit/c29746eea3c3875194b5dcf4b43b8cb714e23329

For whatever reason, it just isn't used in the profiler output.

> Hannes

Lehni

unread,
Apr 15, 2010, 10:38:11 AM4/15/10
to RingoJS
I found a simple fix for now that detects recursion and only measures
the runtime of the 'outmost' method call. This produces more
meaningful values, and therefore also a more meaningful sorting of the
importance of the different call frames.

I agree that self-timing is ideally what one would want, and I guess I
could look into how you implemented that in RhinoJS, but this fix is
enough or me right now. Are you interested in having it in Helma? I
could write a patch.

As for switching over, if I would start from scratch now I would love
to, but I have a full blown CMS framework implemented on top of Helma,
that irons out most of its quirks, and a row of websites running on it
that I keep maintaining. Right now I can neither afford nor find the
time to port it all over, and I keep using this framework for new
sites too, as it is a very convenient way for making sites quickly, so
I keep adding to the framework itself as well. As Helma will not
undergo any fundamental changes anymore I actually started modifying
its code according to my needs and consider forking it into a new
project. As it stands it just makes more sense for me this way.

If there was more compatibility between the two I would consider a
switch, as a compatibility layer would help with converting things
over slowly, but right now there just seems no way to do so that would
not require 100% of my time for at least a few months, which is a bit
sad.

I wonder if I am the only one from the old Helma crowd to think like
this? Maybe I am overestimating the work involved? I would love to
hear experiences from others.

Jürg

> http://github.com/ringo/ringojs/commit/c29746eea3c3875194b5dcf4b43b8c...

Chris Zumbrunn

unread,
Apr 15, 2010, 2:51:35 PM4/15/10
to rin...@googlegroups.com
On Thu, Apr 15, 2010 at 16:38, Lehni <li...@scratchdisk.com> wrote:
>
> I agree that self-timing is ideally what one would want, and I guess I
> could look into how you implemented that in RhinoJS, but this fix is
> enough or me right now. Are you interested in having it in Helma? I
> could write a patch.

RhinoJS? http://ringojs.com/bot/rhinojs ;-)

Hannes Wallnoefer

unread,
Apr 21, 2010, 10:06:48 AM4/21/10
to RingoJS
On Apr 15, 3:33 am, Hannes Wallnoefer <hann...@gmail.com> wrote:
>
> Wait, I actually implemented self-timing a long time ago.
>
> http://github.com/ringo/ringojs/commit/c29746eea3c3875194b5dcf4b43b8c...
>
> For whatever reason, it just isn't used in the profiler output.

FYI, i now switched to self-time in the profiler output, together with
a general overhaul of the profiler module. Profiler output should now
be much more useful[1], and there's a new profile() function that
makes using the profiler much easier than before[2].

[1]: http://ringojs.org/demo/logging?profile=1
[2]: http://ringojs.org/api/master/ringo/profiler#profile

Unfortunately, porting this back to Helma won't be trivial, as Ringo
and Helma are very different beasts (for starters, Ringo's profiler is
written in JS and Helma's in Java).

Hannes



> > Hannes

--
You received this message because you are subscribed to the Google Groups "RingoJS" group.
To post to this group, send email to rin...@googlegroups.com.
To unsubscribe from this group, send email to ringojs+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ringojs?hl=en.

Reply all
Reply to author
Forward
0 new messages