Closed
Bug 691731
Opened 14 years ago
Closed 14 years ago
Use mmap, not vm_allocate, on Mac
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: igor, Assigned: igor)
References
Details
(Keywords: perf)
Attachments
(2 files)
|
1.98 KB,
text/plain
|
Details | |
|
10.45 KB,
patch
|
Details | Diff | Splinter Review |
Currently the GC chunk allocator uses vm_allocate, not mmap, on Mac OS X, to allocate GC chunks. However on OSX 10.7 those functions are significantly slower that mmap. The attached test C program tests that via repeatedly allocating a series of 1MB chunks and then releasing them using either mmap or vm_allocate.
On Mac Mini with OS X 10.7I get for a typical run using vm_allocate:
@users-Mac-mini~/s> time ./a.out vm
real 0m0.045s
user 0m0.004s
sys 0m0.041s
With mmap numbers become:
@users-Mac-mini~/s> time ./a.out mmap
real 0m0.026s
user 0m0.003s
sys 0m0.016s
That is, the program runs 2 times faster.
If I change the chunk size from 1MB to 64K, then the number becomes:
@users-Mac-mini~/s> time ./a.out vm
real 0m3.134s
user 0m0.065s
sys 0m3.069s
@users-Mac-mini~/s> time ./a.out mmap
real 0m2.767s
user 0m0.043s
sys 0m2.717s
Which is still 13% faster.
Given this results I suggest to use mmap for chunk allocation on MAC OSX.
Comment 1•14 years ago
|
||
Do you have any indication that the functions are the same speed on 10.{5,6}?
| Assignee | ||
Comment 2•14 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #1)
> Do you have any indication that the functions are the same speed on 10.{5,6}?
I do not know about older MACs. I plan to prepare a patch and see how it affects Talos try server runs.
| Assignee | ||
Comment 3•14 years ago
|
||
The patch removes Mac-specific code that uses vm-allocate so now Mac uses the chunk allocation based on mmap code. In the same time the patch optimizes that to take advantage of munmap ability to release a part of existing mmap alocation. Also on Windows the code use VirtualAlloc without a commit when searching for unallocated address space where the aligned chunk can be placed.
Assignee: general → igor
| Assignee | ||
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•