Closed
Bug 1518101
Opened 5 years ago
Closed 5 years ago
Add Nursery::allocateZeroedBuffer for inlined TypedArray construction
Categories
(Core :: JavaScript: GC, enhancement)
Core
JavaScript: GC
Tracking
()
RESOLVED
FIXED
mozilla66
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file)
3.72 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
AllocateObjectBufferWithInit in the inlined TypedArray construction path is currently using malloc followed by memset to create zero-initialized memory for the TypedArray. This leads to sadness when doing µ-benchmarks for TypedArray construction performance, because memset touches every page of the allocated memory, which means the benchmark easily ends up allocating the complete system memory and we soon are measuring how fast the system can perform swap. In numbers: The following µ-benchmark reports about four seconds in the "total" count and effectively uses ~8GB memory on my system. When using calloc the "total" count is ~30ms and the memory usage is basically zero. --- function f() { var r = 0; var t = dateNow(); for (var i = 0; i < 2000; ++i) { var ta = new Int32Array(265000 + (i & 0x1)); r += ta.length; } return [dateNow() - t, r]; } var t = dateNow() for (var i = 0; i < 5; ++i) print(f()); print("total:", (dateNow() - t)); ---
Assignee | ||
Comment 1•5 years ago
|
||
Adds Nursery::allocateZeroedBuffer, which almost the same as Nursery::allocateBuffer, except calloc instead of malloc is used.
Attachment #9034717 -
Flags: review?(jcoppeard)
Comment 2•5 years ago
|
||
Comment on attachment 9034717 [details] [diff] [review] bug1518101.patch Review of attachment 9034717 [details] [diff] [review]: ----------------------------------------------------------------- Great, thanks for fixing.
Attachment #9034717 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Comment 3•5 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=22537cf2fd00e4af6132abd7a05827c37bd79eda
Keywords: checkin-needed
Pushed by ccoroiu@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/19051af76b77
Use calloc instead of malloc followed by memset for inlined TypedArray data allocation. r=jonco
Keywords: checkin-needed
Comment 5•5 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in
before you can comment on or make changes to this bug.
Description
•