It sounds like you're talking about lazy source positions, but the code
you've listed there shouldn't be affected by that since it never symbolizes
a stack trace. You could confirm that by disabling it with the flag
--no-enable-lazy-source-positions.

If you added "var a = x.stack;" to your test8 function then it would
trigger symbolization (without printing it), since stack is actually a
function masquerading as a variable and so even accessing it will trigger
source position collection. I would then expect the first iteration to be
slower as it reparses, but then subsequent iterations would be fast.

Dan

On Mon, 10 Feb 2020 at 15:20, Wilfried Gösgens <dotheb...@gmail.com> wrote:

> Hi,
> reading the changelog I saw that many things changed about stacktrace
> generation in the recent V8 versions, which should change the performance
> of generating the error instance?
> I've tried this simple test with arangodb's arangosh and its embedded V8
> versions 7.1 and 7.9:
>
> function test1() {
>   function test2() {
>     function test3() {
>       function test4() {
>         function test5() {
>           function test6() {
>             function test7() {
>               function test8() {
>                 x= new Error;
>                 return 1;
>               }
>               return test8();
>             }
>             return test7();
>           }
>           return test6();
>         }
>         return test5();
>       }
>       return test4();
>     }
>     return test3();
>   }
>   return test2();
> }
>
> before = time();
> for (let i = 1; i < 50; i ++) {
>   test1();
> }
> print(time() - before);
>
>
> 7.1:  - (as in ArangoDB 3.6) 0.0012750625610351562
> 7.9: - (as in current devel) 0.6016845703125
>
> The figures are similar when I throw the error and catch it inside that
> for loop.
> I've read that later V8 reparses the source in order to get the printeable
> stacktrace; is this what gives such a worse performance here?
> If yes, which way is one to achieve similar / faster performance with
> recent V8 versions?
>
> Cheers,
> Willi
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/f27ad537-86c5-4f3e-be8c-b25b73dea7af%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-users/f27ad537-86c5-4f3e-be8c-b25b73dea7af%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CALH_77sAzkDMDa-1h3p0e4T8XbDK9-Z6WNJXRqk%3DJuu1qquXLw%40mail.gmail.com.

Reply via email to