Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't use unsafe Heap::new constructor #20314
Conversation
highfive
commented
Mar 16, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Mar 16, 2018
|
When we've tried to evaluate JS perf changes in the past, we've run |
|
The travisCI failure is #14774 . |
|
I did 3 runs on master and patch, averaged the results and compare those.
for different tests (always with Also probably
Besides couple of tests, like Re travis: is this something that needs to be resolved before this can land? |
|
I wonder if those tests even execute these code paths, since I don't think there are dictionaries involved in those APIs. It's probably worth measuring one particular API that makes use of a dictionary that contains an object or any value. |
|
I think it makes sense to base the benchmark on key/value iterable like in https://github.com/servo/servo/blob/master/tests/wpt/mozilla/tests/mozilla/iterable.html. How should I measure the tests? Should I create a dummy HTML with the script, run the browser exe against it (like in run_dromaeo?) and measure the time it takes to finish? Is there a benchmark/performance test suite/mode for WPT tests? |
|
Yes, creating an HTML file like https://github.com/servo/servo/blob/master/tests/html/mut_observer_perf.html is the best way to go about it. There's no existing benchmark suite; just one-off pages like that. |
|
So I tried creating a HTML benchmark, but I'm still not sure if I'm doing it right.
and for both my local master (b93f153) and the branch I had average times 0.0296~0.0304s on a i5-2520m CPU and the times distribution seemed the same for both.
I believe this should test the code path now, since despite the fact that iterable is generic over non- the generated code uses unsafe extern fn entries(cx: *mut JSContext, _obj: HandleObject, this: *const TestBindingPairIterable, args: *const JSJitMethodCallArgs) -> bool {
return wrap_panic(panic::AssertUnwindSafe(|| {
let this = &*this;
let args = &*args;
let argc = args._base.argc_;
let result = IterableIterator::new(&*this,
IteratorType::Entries,
super::TestBindingPairIterableIteratorBinding::Wrap);
(result).to_jsval(cx, args.rval());
return true;
}), false);
}which in turns uses the modified API in |
|
The panic is a result of a GC occurring and #19872. That looks like a sensible benchmark to me :) |
|
Cool, thanks for taking a look! So does it need more work or is it just blocked on servo/rust-mozjs#398? |
|
@bors-servo r+ |
|
|
Don't use unsafe Heap::new constructor <!-- Please describe your changes on the following line: --> Pulls servo/rust-mozjs#398 and aims to close servo/rust-mozjs#343. We can't convert from `JSVal` to `Heap<JSVal>` safely (due to GC barriers we can't move Heap value after changing its underlying value to something meaningful, e.g. non-null or non-undefined), so I decided to also wrap the Heap values in a Box (and in dictionaries in RootedTraceableBox, see #20265 (comment) and the issue for more details) in dictionaries. Since we allocate more to be safe, I think it'd be good to also do some sort of a JS perf run, if there is any to see if there's any significant overhead. r? @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because checking for not moving Heap after setting a value would require encoding a lot more info in type system (Heap) and I'm not sure how to do that and end up with an ergonomic and consistent API <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20314) <!-- Reviewable:end -->
|
|
Use upstream mozjs 0.3 Pulls published mozjs 0.3 instead of my forked version (#20314). r? @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20333) <!-- Reviewable:end -->
…0.3); r=jdm Pulls published mozjs 0.3 instead of my forked version (servo/servo#20314). r? @jdm Source-Repo: https://github.com/servo/servo Source-Revision: 2d0f8712a6a5d1435686270756048503e837dd20 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 846208912abff4a71bafbbecb8e620caab4eb084
…0.3); r=jdm Pulls published mozjs 0.3 instead of my forked version (servo/servo#20314). r? jdm Source-Repo: https://github.com/servo/servo Source-Revision: 2d0f8712a6a5d1435686270756048503e837dd20 UltraBlame original commit: 4be9ce9a82a0c7d68014a062abb9240cdbfd913f
…0.3); r=jdm Pulls published mozjs 0.3 instead of my forked version (servo/servo#20314). r? jdm Source-Repo: https://github.com/servo/servo Source-Revision: 2d0f8712a6a5d1435686270756048503e837dd20 UltraBlame original commit: 4be9ce9a82a0c7d68014a062abb9240cdbfd913f
…0.3); r=jdm Pulls published mozjs 0.3 instead of my forked version (servo/servo#20314). r? jdm Source-Repo: https://github.com/servo/servo Source-Revision: 2d0f8712a6a5d1435686270756048503e837dd20 UltraBlame original commit: 4be9ce9a82a0c7d68014a062abb9240cdbfd913f
Xanewok commentedMar 16, 2018
•
edited by SimonSapin
Pulls servo/rust-mozjs#398 and aims to close servo/rust-mozjs#343.
We can't convert from
JSValtoHeap<JSVal>safely (due to GC barriers we can't move Heap value after changing its underlying value to something meaningful, e.g. non-null or non-undefined), so I decided to also wrap the Heap values in a Box (and in dictionaries in RootedTraceableBox, see #20265 (comment) and the issue for more details) in dictionaries.Since we allocate more to be safe, I think it'd be good to also do some sort of a JS perf run, if there is any to see if there's any significant overhead.
r? @jdm
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is