|
|
Created:
3 years, 10 months ago by Choongwoo Han Modified:
3 years, 10 months ago CC:
v8-reviews_googlegroups.com, Dan Ehrenberg Target Ref:
refs/pending/heads/master Project:
v8 Visibility:
Public. |
Description[typedarrays] sort in C++ for no comparison function
- If no comparison function is given for %TypedArray%.prototype.sort,
sort the typedarray using std::sort in C++. This gets 20 times more
benchmark score in Float64Array.
- Move ValidateTypedArray in builtin-typedarray.cc to static inline
method of JSTypedArray class.
BUG=v8:5953
Review-Url: https://codereview.chromium.org/2693043009
Cr-Commit-Position: refs/heads/master@{#43427}
Committed: https://chromium.googlesource.com/v8/v8/+/32ec5335a4e2e385ecf89984c8f5dcc667b5dfb7
Patch Set 1 #
Total comments: 1
Patch Set 2 : Split tests and codes #
Total comments: 3
Patch Set 3 : Move ValidateTypedArray to JSTypedArray:Validate #
Total comments: 1
Patch Set 4 : for win #Patch Set 5 : static casting #Patch Set 6 : [typedarrays] sort in C++ for no comparison function #
Messages
Total messages: 40 (26 generated)
Description was changed from ========== [typedarrays] sort in C++ for undefined comparefn - Add benchmark for sorting of Float64Array. - If no compare function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. - Rename existing typedarray.js to copywith.in in js-perf-test. BUG=v8:5953 ========== to ========== [typedarrays] sort in C++ for undefined comparefn - Add benchmark for sorting of Float64Array. - If no compare function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. - Rename existing typedarray.js to copywith.in in js-perf-test. BUG=v8:5953 ==========
cwhan.tunz@gmail.com changed reviewers: + bmeurer@chromium.org
PTAL
bmeurer@chromium.org changed reviewers: + caitp@chromium.org, petermarshall@chromium.org
Thanks for the patch. Adding petermarshall@ and caitp@ for review. Please split the js-perf-test changes into a separate CL and land those first, so we actually track the improvements of this CL (and follow-up CLs). https://codereview.chromium.org/2693043009/diff/1/src/js/typedarray.js File src/js/typedarray.js (right): https://codereview.chromium.org/2693043009/diff/1/src/js/typedarray.js#newcod... src/js/typedarray.js:540: return %_TypedArraySortFast(this); Since you call to the runtime anyways, just use %TypedArraySortFast here. The %_ notation is used for intrinsics, that can be provided by the various compilers, and not necessarily end up as a runtime call.
Description was changed from ========== [typedarrays] sort in C++ for undefined comparefn - Add benchmark for sorting of Float64Array. - If no compare function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. - Rename existing typedarray.js to copywith.in in js-perf-test. BUG=v8:5953 ========== to ========== [typedarrays] sort in C++ for no comparison function If no comparison function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. BUG=v8:5953 ==========
On 2017/02/15 05:08:04, Benedikt Meurer wrote: > Thanks for the patch. Adding petermarshall@ and caitp@ for review. > > Please split the js-perf-test changes into a separate CL and land those first, > so we actually track the improvements of this CL (and follow-up CLs). Split done: https://codereview.chromium.org/2691423003/ > > https://codereview.chromium.org/2693043009/diff/1/src/js/typedarray.js > File src/js/typedarray.js (right): > > https://codereview.chromium.org/2693043009/diff/1/src/js/typedarray.js#newcod... > src/js/typedarray.js:540: return %_TypedArraySortFast(this); > Since you call to the runtime anyways, just use %TypedArraySortFast here. The %_ > notation is used for intrinsics, that can be provided by the various compilers, > and not necessarily end up as a runtime call. Done
caitp@igalia.com changed reviewers: + caitp@igalia.com
https://codereview.chromium.org/2693043009/diff/20001/src/runtime/runtime-typ... File src/runtime/runtime-typedarray.cc (right): https://codereview.chromium.org/2693043009/diff/20001/src/runtime/runtime-typ... src/runtime/runtime-typedarray.cc:405: THROW_NEW_ERROR_RETURN_FAILURE( So, as Dan was saying, we probably want to jist early return if neutered, and make all cases throw simultaneously in the same CL.
https://codereview.chromium.org/2693043009/diff/20001/src/runtime/runtime-typ... File src/runtime/runtime-typedarray.cc (right): https://codereview.chromium.org/2693043009/diff/20001/src/runtime/runtime-typ... src/runtime/runtime-typedarray.cc:405: THROW_NEW_ERROR_RETURN_FAILURE( On 2017/02/15 12:24:20, caitp wrote: > So, as Dan was saying, we probably want to jist early return if neutered, and > make all cases throw simultaneously in the same CL. To add to this, maybe move ValidateTypedArray() in builtins-typedarray to a static inline JSTypedArray method (`MaybeHandle<JSTypedArray> JSTypedArray::Validate(isolate, Handle<Object>) ...` or something like that?) and use that instead of duplicating the logic here. That will make it easier to do the "throw in all algorithms simultaneously" later
Description was changed from ========== [typedarrays] sort in C++ for no comparison function If no comparison function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. BUG=v8:5953 ========== to ========== [typedarrays] sort in C++ for no comparison function - If no comparison function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. - Move ValidateTypedArray in builtin-typedarray.cc to static inline method of JSTypedArray class. BUG=v8:5953 ==========
https://codereview.chromium.org/2693043009/diff/20001/src/runtime/runtime-typ... File src/runtime/runtime-typedarray.cc (right): https://codereview.chromium.org/2693043009/diff/20001/src/runtime/runtime-typ... src/runtime/runtime-typedarray.cc:405: THROW_NEW_ERROR_RETURN_FAILURE( On 2017/02/15 13:27:22, caitp wrote: > On 2017/02/15 12:24:20, caitp wrote: > > So, as Dan was saying, we probably want to jist early return if neutered, and > > make all cases throw simultaneously in the same CL. > > To add to this, maybe move ValidateTypedArray() in builtins-typedarray to a > static inline JSTypedArray method (`MaybeHandle<JSTypedArray> > JSTypedArray::Validate(isolate, Handle<Object>) ...` or something like that?) > and use that instead of duplicating the logic here. That will make it easier to > do the "throw in all algorithms simultaneously" later Done. I've moved it to static inline method of JSTypedArray.
Sorry for the delay. LGTM, thanks!
The CQ bit was checked by cwhan.tunz@gmail.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_win_compile_dbg on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_compile_dbg/builds/3...) v8_win_nosnap_shared_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...) v8_win_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/23034)
The compile error can be fixed with this polyfill: #ifdef V8_CC_MSVC namespace std { template <typename T> bool signbit(T _x) throw() { static_assert(std::is_integral<T>::value, "Must be integral"); return signbit(static_cast<double>(_x)); } } #endif See http://en.cppreference.com/w/cpp/numeric/math/signbit
https://codereview.chromium.org/2693043009/diff/40001/src/runtime/runtime-typ... File src/runtime/runtime-typedarray.cc (right): https://codereview.chromium.org/2693043009/diff/40001/src/runtime/runtime-typ... src/runtime/runtime-typedarray.cc:379: return std::signbit(x) ? true : false; \ What about just `return (std::is_integral<T>::value ? x < 0 : std::signbit(x)) ? true : false` I think that should get past the msvc problem. You can make it easier to read by using a variable instead of doing it all in one expression. Should avoid needing to polyfill any libc++ methods
The CQ bit was checked by cwhan.tunz@gmail.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_win_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/23137)
okey. The compiler seems not so smart. I think I can just separate floating typed arrays and integer typed arrays (no callbacks for int typed arrays). but, now i'm out of town so I'll check it out tomorrow.
The CQ bit was checked by cwhan.tunz@gmail.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_win_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/23190)
The CQ bit was checked by cwhan.tunz@gmail.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
simply static casting to double for std::isnan and std::signbit. I think their direct static casting does not lose any information about NAN or signbit. seems okey?
The CQ bit was checked by cwhan.tunz@gmail.com
The patchset sent to the CQ was uploaded after l-g-t-m from bmeurer@chromium.org Link to the patchset: https://codereview.chromium.org/2693043009/#ps100001 (title: "[typedarrays] sort in C++ for no comparison function")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 100001, "attempt_start_ts": 1487987534864450, "parent_rev": "64a563c97f84c474a3f8b9a6b02c68ec1728cfee", "commit_rev": "32ec5335a4e2e385ecf89984c8f5dcc667b5dfb7"}
Message was sent while issue was closed.
Description was changed from ========== [typedarrays] sort in C++ for no comparison function - If no comparison function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. - Move ValidateTypedArray in builtin-typedarray.cc to static inline method of JSTypedArray class. BUG=v8:5953 ========== to ========== [typedarrays] sort in C++ for no comparison function - If no comparison function is given for %TypedArray%.prototype.sort, sort the typedarray using std::sort in C++. This gets 20 times more benchmark score in Float64Array. - Move ValidateTypedArray in builtin-typedarray.cc to static inline method of JSTypedArray class. BUG=v8:5953 Review-Url: https://codereview.chromium.org/2693043009 Cr-Commit-Position: refs/heads/master@{#43427} Committed: https://chromium.googlesource.com/v8/v8/+/32ec5335a4e2e385ecf89984c8f5dcc667b... ==========
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as https://chromium.googlesource.com/v8/v8/+/32ec5335a4e2e385ecf89984c8f5dcc667b... |