Allow request_cache to be constant-folded in Bugzilla.pm

RESOLVED FIXED

Status

()

enhancement
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: dylan, Assigned: dylan)

Tracking

(Blocks 1 bug, {perf})

Production
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

45 bytes, text/x-github-pull-request
Details | Review
We already declare request_cache() using the constant pragma. We do this because calling an xsub (briefly, a subroutine written in C) is very fast.

However, if we call request_cache() as a subroutine (and not as a class method) the perl compiler is able to constant-fold it. This means there is *no* overhead.

Over half of all calls to Bugzilla->request_cache() happen inside Bugzilla.pm,
so doing s/\$(self|_\[0\])->request_cache/request_cache/ there will result in a nice speed up.
(okay, only from 2ms to 600µs). 

Changing it in other places will require additional work, as modules are not supposed to 'use Bugzilla'
and constant folding requires the subroutine to be declared at compile time...

Comment 1

a year ago
Posted file github pull request
Assignee: nobody → dylan
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.