I don't think so. If the typed array is large (length >= 2^31) then the (signed) overflow can and will happen when i = 2^31 - 1. [side note: even unsigned overflow (carry flag) would happen when i = 2^32 - 1, which the max length of 2^32 allows for.]
Suraj, I'll take a closer look at this when I find time and will comment in your document. Thanks! Georg On Wed, Feb 3, 2021 at 7:32 PM Jakob Kummerow <jkumme...@chromium.org> wrote: > 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 < > v8-dev@googlegroups.com> 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 >> v8-dev@googlegroups.com >> 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 v8-dev+unsubscr...@googlegroups.com. >> 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 > v8-dev@googlegroups.com > 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 v8-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/v8-dev/CAKSzg3QKPe-3CwFm%2BU626FX2JTaNrT1u6ZD%3DF1izQfnsYwgyaA%40mail.gmail.com > <https://groups.google.com/d/msgid/v8-dev/CAKSzg3QKPe-3CwFm%2BU626FX2JTaNrT1u6ZD%3DF1izQfnsYwgyaA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- -- v8-dev mailing list v8-dev@googlegroups.com 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 v8-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CABT__oEJ_nWrfrKWmf-pShVPX310Dxg3C8cskEf9de1G8UNL1w%40mail.gmail.com.