Isn't this an off-by-one error of sorts? I'm by no means an expert on
Turbofan range analysis, but it seems that if TF realized that i is
strictly less than the array length, then that would be enough to optimize
away the overflow check on the increment?


On Wed, Feb 3, 2021 at 5:46 AM 'Suraj Sharma' via v8-dev <
[email protected]> wrote:

> Hello everyone,
>
> I was running a micro benchmark(attached at the bottom) and noticed
> something interesting.
>
> There is a significant difference in performance  between TypedArray and
> regular JSArray when performing arithmetic in a loop,
>
> When timing the function foo() on release build of d8 on x64 machine we
> get following result:
>
> JSArray: 616 ms
>
> TypedArray: 1261 ms
>
> I did some investigation and found that we always perform an overflow
> check for loop variable i when using TypedArray irrespective of the value
> of length.
>
> I have made some progress in addressing this issue, but need some help in
> putting some pieces together.
>
> Here is the link
> <https://docs.google.com/document/d/1tBwy698i0TUhQa5-uxEp3_5y9557bniMfyXjHCTn3OU/edit?usp=sharing>summarizing
> my investigation.
>
> PTAL
>
> Thanks
>
> Suraj
>
> [image: foo.png]
>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/c2c96e24-ce44-4afb-9a98-ab2829c9cae2n%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-dev/c2c96e24-ce44-4afb-9a98-ab2829c9cae2n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAKSzg3QKPe-3CwFm%2BU626FX2JTaNrT1u6ZD%3DF1izQfnsYwgyaA%40mail.gmail.com.

Reply via email to