• Simon Zünd's avatar
    [typedarray] Implement TypedArray.p.sort using Torque. · 3ea1ad23
    Simon Zünd authored
    This CL implements TypedArray.p.sort in Torque. The Torque
    version works basically the same as the existing JS builtin:
    
    When no comparison function is provided, the C++ fast path builtin
    is used. Otherwise a quicksort written in Torque is used, with
    a InsertionSort fallback for smaller arrays.
    
    The JS quicksort implementation also containes a more elaborate
    third pivot calculation for larger arrays. This is currently not done.
    
    Reported benchmark results are only for those, where a custom
    comparison function is provided. The numbers for the C++ path stayed
    the same.
    
    Benchmark   Current (JS)       Torque    Speedup
    
    IntTypes            83.9        263.7        3.1
    BigIntTypes         32.1         54.6        1.7
    FloatTypes          99.3        138.7        1.4
    
    R=danno@chromium.org, jgruber@chromium.org
    
    Bug: v8:7382
    Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
    Change-Id: I7abe7ceff525bab24f302d2f06b5961cca770d24
    Reviewed-on: https://chromium-review.googlesource.com/1021691
    Commit-Queue: Simon Zünd <szuend@google.com>
    Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
    Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
    Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#52776}
    3ea1ad23
typedarray.js 2.16 KB