Hooks overhead

From MediaWiki.org
Jump to: navigation, search

Following hook performance discussion at the NOLA Hackathon:

[edit] Number of hook calls

  • Special:BlankPage: 384 calls
  • en:Barack Obama import: 62112 calls (Cite and PF were disabled)
  • en:Barack Obama uncached page view: 138797 calls (with Cite and PF)

[edit] Hook performance

Running tests with 10000 repetititons:

No hooks defined, repeatedly running the same hook via wfRunHooks(): 3.2485961914063E-6 s/call
No hooks defined, repeatedly running the same hook via Hooks::run(): 2.5429964065552E-6 s/call
From now on, using the fastest calling method, Hooks::run()....
No hooks defined, different hook called each time: 2.9288053512573E-6 s/call
Calling the same empty static hook: 2.8852891921997E-5 s/call
Calling the same empty member function hook: 3.0839109420776E-5 s/call
200 hooks defined, calling the same unset hook: 2.6947021484375E-6 s/call
200 hooks defined, calling the same defined hook: 0.00013253707885742 s/call

So that's something on the order of 1ms delay per 300-ish calls?

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox