Allow request_cache to be constant-folded in Bugzilla.pm

RESOLVED FIXED

Status

()

RESOLVED FIXED
a year ago
11 months ago

People

(Reporter: dylan, Assigned: dylan)

Tracking

(Blocks: 1 bug, {perf})

Production

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

45 bytes, text/x-github-pull-request
Details | Review | Splinter 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)

Updated

a year ago
Assignee: nobody → dylan
(Assignee)

Updated

11 months ago
Status: NEW → RESOLVED
Last Resolved: 11 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.