Closed Bug 1439788 Opened 4 years ago Closed 4 years ago

Having performance.now added to spidermonkey's shell would help with perf diagnosis

Categories

(Core :: JavaScript Engine, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: canuckistani, Assigned: diorahman, Mentored)

References

()

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Attachments

(1 file)

Spidermonkey and V8 can have different performance characteristics, and access to performance apis in the shell might make certain kinds of investigations more convenient:

"[I wanted to sprinkle performance.now() but SpiderMonkey shell apparently does not support it.]"

See http://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html
We have dateNow in the shell; we could rename/alias it.
Priority: -- → P5
Mentor: arai.unmht
Keywords: good-first-bug
Whiteboard: [lang=c++]
Required code changes are following:
  1. Define `performance` object in the shell global
  2. Define `now` property to the `performance` object, with the same value as `dateNow` [1][2]

Bug 1118158 would be a good example, which added `console.log` [3][4][5].

You'll need basic knowledge of C++, and be able to build and test SpiderMonkey shell [6][7].

A skilled first-time contributor should be able to finish this in a month.  Leave comments / questions here, or ask me (:arai) in IRC [8] #introduction or #jsapi channels.

[1] https://searchfox.org/mozilla-central/rev/47cb352984bac15c476dcd75f8360f902673cb98/js/src/shell/js.cpp#6848-6850
[2] https://searchfox.org/mozilla-central/rev/47cb352984bac15c476dcd75f8360f902673cb98/js/src/shell/js.cpp#2274-2281
[3] https://hg.mozilla.org/mozilla-central/rev/58d6a621d9626547407708b7c78cf5dbf1fa935a
[4] https://searchfox.org/mozilla-central/rev/47cb352984bac15c476dcd75f8360f902673cb98/js/src/shell/js.cpp#7387-7402
[5] https://searchfox.org/mozilla-central/rev/47cb352984bac15c476dcd75f8360f902673cb98/js/src/shell/js.cpp#8305-8306
[6] https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation
[7] https://developer.mozilla.org/en-US/docs/Simple_Firefox_build
[8] https://wiki.mozilla.org/index.php?title=IRC
Hi Tooru, may I take this bug?
Flags: needinfo?(arai.unmht)
Assignee: nobody → diorahman
Status: NEW → ASSIGNED
Attachment #8955760 - Flags: review?(arai.unmht)
Comment on attachment 8955760 [details] [diff] [review]
Add performance.now() function to JS shell

Review of attachment 8955760 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you for taking this :)
Looks great!
Attachment #8955760 - Flags: review?(arai.unmht) → review+
Flags: needinfo?(arai.unmht)
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c59eff0e8209
Add performance.now() function to JS shell. r=arai
https://hg.mozilla.org/mozilla-central/rev/c59eff0e8209
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.