Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32 cleanup #25

Open
bulk88 opened this issue Mar 24, 2014 · 1 comment
Open

win32 cleanup #25

bulk88 opened this issue Mar 24, 2014 · 1 comment

Comments

@bulk88
Copy link
Contributor

bulk88 commented Mar 24, 2014

I decided to look inside NYTProf on Win32, since Ive used it a couple times, but it has some dire warnings about it using Time::HiRes added in bc9145a , but looking at my binary shows this to be false, perl has had HAS_GETTIMEOFDAY since 2002 Perl/perl5@57ab3df in Win32 which a wrapper around Win32's GetSystemTimeAsFileTime C function. No compensation or adjustments are done to the time other than fixed unit conversions. So NYTProf doesn't use QueryPerformanceCounter directly (I'd like to implement that) or indirectly through Time::HiRes. Can you give some explanation about that comment about NYTProf on Win32?

I also have a PERL_NO_GET_CONTEXT patch almost done.

Also why does https://github.com/timbunce/devel-nytprof/blob/master/NYTProf.xs#L4305

        (void)hv_fetch_ent((HV *)SvRV(sv), caller_subname_sv, 1, 0);

exist?

Also load_sub_callers_callback and pretty much all of NYTProf uses av_fetch a ton. Why not use AvARRAY everywhere? I assume the private av can't be tied.

@timbunce
Copy link
Owner

timbunce commented Oct 5, 2014

I don't remember the details off-hand, but this:

        /* XXX temp hack way to store calling subname */
        sv = *av_fetch(av, NYTP_SCi_CALLING_SUB, 1);
        if (!SvROK(sv))               /* autoviv */
            sv_setsv(sv, newRV_noinc((SV*)newHV()));
        (void)hv_fetch_ent((HV *)SvRV(sv), caller_subname_sv, 1, 0);

looks like it's using hv_fetch_ent to ensure that a key for caller_subname_sv at least exists.
I've added a comment.

I agree that most av_fetch's in hot code paths could be replaced with something faster. Many have lval true though. So perhaps something like this:

#define av_fetch_fast(a, i, l) ((i > AvFILLp(a) || !AvARRAY(a)[k]) ? av_fetch(a, i, l) : &AvARRAY(av)[key])

I'd be delighted if you'd work on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants