Page MenuHomePhabricator

Time profiling: Replace millisecond granularity timers with microsecond granularity timers
Closed, ResolvedPublic

Description

We use Date.now() to profile times. But, as part of the PHP porting effort, while attempting to compare PHP and node.js times for different components, @Sbailey wanted to make sure we are using similar granularity timers and we found that Date.now() is a millisecond granularity timer and is not appropriate for some of the profiling we were doing there. @Sbailey found a microsecond timer for using in the node.js transformTests.js script.

That same consideration applies to the profiling (--trace time) code we have in the parsing paths. We should replace all uses of Time.now() with a profiling api that uses the microsecond timers underneath and use that profiling api everywhere.

git grep Date.now will probably reveal all those uses.

This may also bridge some of the gap between the 'Total parse time' and 'Total profiled time` that has been bugging me since the very beginning.

Event Timeline

ssastry moved this task from Needs Triage to Performance on the Parsoid board.
ssastry renamed this task from Time profiling: Replace millisecond granulairty timers with microsecond granularity timers to Time profiling: Replace millisecond granularity timers with microsecond granularity timers.Oct 17 2018, 3:00 PM
ssastry assigned this task to Sbailey.
ssastry updated the task description. (Show Details)

Change 471168 had a related patch set uploaded (by Sbailey; owner: Sbailey):
[mediawiki/services/parsoid@master] Added high res timer to parsoid

https://gerrit.wikimedia.org/r/471168

Change 471168 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Added high resolution timer functionality to parsoid

https://gerrit.wikimedia.org/r/471168

Change 472512 had a related patch set uploaded (by Sbailey; owner: Sbailey):
[mediawiki/services/parsoid@master] Added high resolution timer functionality to parsoid

https://gerrit.wikimedia.org/r/472512

Change 472512 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Fixed wrong format jsdoc info in new jsutil methods.

https://gerrit.wikimedia.org/r/472512