timbunce / devel-nytprof

Devel::NYTProf is a powerful feature-rich source code profiler for Perl. (Mostly in maintenance mode, so PRs are much more likely to be acted upon than Issues.)
http://blog.timbunce.org/tag/nytprof/
67 stars 50 forks source link

Unstable results on macOS #209

Open hurricup opened 1 year ago

hurricup commented 1 year ago

Recently I started to expand integration tests for my Perl plugin for IntelliJ IDEA and found out that for some reason profiler produces unstable results in different runs. Ubuntu and Windows are fine.

Here is my test script:

sub something {
    my $scalar = 1;
    if ($scalar > 2) {
        print "false";
    }
    elsif ($scalar < 2) {
        print 'true';
    }
    print 'done';
}

BEGIN{
    print 'begin block';
}

print 42;
something();

END{
    print 'this is the end';
}

And here are 2 different runs stmts=0:calls=2:savesrc=0:slowops=1:sigexit=1:addpid=1:start=init:

image

And here are 2 different runs stmts=0:calls=2:savesrc=0:slowops=1:sigexit=1:addpid=1:start=begin:

image

Cross-reference: Camelcade/Perl5-IDEA#2609

hurricup commented 1 year ago

optimize flag does not make a difference