devel-nytprof icon indicating copy to clipboard operation
devel-nytprof copied to clipboard

call counts for xs subs as methods on objects seem to be off

Open wchristian opened this issue 10 years ago • 1 comments

Here's an archive with an example script, a profile run of it, and the nytprofhtml analysis:

https://dl.dropboxusercontent.com/u/10190786/xs_sub_methods.zip

Of note is that the calls for ->timings each have a count of 10, while the calls for ->sprites each have a count of 1.

Here's the example script:

use strict;
use warnings;

{

    package Object;
    use Moo;

    has timings => ( is => 'rw', lazy => 1, builder => 1 );
    has sprites => ( is => 'rw', default => sub { 0 } );

    sub _build_timings { 1 }
}

run();

sub run {
    my $object = Object->new;

    for ( 1 .. 10 ) {
        my $t = $object->timings;
        $object->timings( $t + 1 );

        my $s = $object->sprites;
        $object->sprites( $s + 1 );
    }

    print $object->timings . " " . $object->sprites;
}

wchristian avatar Apr 24 '15 11:04 wchristian

Does this relate to #72?

Can you create a small test case with Sub::Quote only (either for this or #72) and include it inline here?

timbunce avatar Aug 02 '15 19:08 timbunce