Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new-disp has a performance issues? #4525

Closed
melezhik opened this issue Sep 14, 2021 · 16 comments
Closed

new-disp has a performance issues? #4525

melezhik opened this issue Sep 14, 2021 · 16 comments
Labels
new-disp A bug specific to the new-disp branch

Comments

@melezhik
Copy link

I chose previous r3 test and it shows some time increase for new-disp branch, especially the last example :

0.0088719 VS 0.0102194

RAKUBIN=raku RAKUBIN2=/root/projects/rakudo/install/bin/raku   tomty performace_01

[repository] :: index updated from file:///root/repo/api/v1/index
[performace_01] :: Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2021.07.
[performace_01] :: Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
[performace_01] :: Built on MoarVM version 2021.07.
[performace_01] :: Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2021.08-169-g16142c71c.
[performace_01] :: Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
[performace_01] :: Built on MoarVM version 2021.08-514-g32e0c279f.
[performace_01] :: time: 0.0004326
[performace_01] ::  <== (-e say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: time: 0.0004781
[performace_01] ::  <== (-e say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (0 1 2 3 4)
[performace_01] :: time: 0.0035126
[performace_01] ::  <== (-e say ^10 .map: { $_ == 5 ?? (last)   !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0 1 2 3 4)
[performace_01] :: time: 0.0064052
[performace_01] ::  <== (-e say ^10 .map: { $_ == 5 ?? (last)   !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (0 1 2 3 4 42)
[performace_01] :: time: 0.0044391
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .map: { $_ == 5 ?? last(42) !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0 1 2 3 4 42)
[performace_01] :: time: 0.0067677
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .map: { $_ == 5 ?? last(42) !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (0 2 4)
[performace_01] :: time: 0.0039387
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? (last)  !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0 2 4)
[performace_01] :: time: 0.0063509
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? (last) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (0 2 4)
[performace_01] :: time: 0.0059687
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last()  !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0 2 4)
[performace_01] :: time: 0.0065837
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last() !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (0 2 4 5)
[performace_01] :: time: 0.00313
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last(True) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0 2 4 5)
[performace_01] :: time: 0.0070137
[performace_01] ::  <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last(True) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (1 2 3 4)
[performace_01] :: time: 0.0044199
[performace_01] ::  <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? (last) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (1 2 3 4)
[performace_01] :: time: 0.010215
[performace_01] ::  <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? (last) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (1 2 3 4 42)
[performace_01] :: time: 0.0046436
[performace_01] ::  <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? last(42) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (1 2 3 4 42)
[performace_01] :: time: 0.0061957
[performace_01] ::  <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? last(42) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: ===
[performace_01] :: (0, 1, 2, 3, 4, 42, 66).Seq
[performace_01] :: time: 0.0088719
[performace_01] ::  <== (-e use v6.e.PREVIEW; dd ^10 .map: { last slip(42,66) if $_ == 5; $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0, 1, 2, 3, 4, 42, 66).Seq
[performace_01] :: time: 0.0102194
[performace_01] ::  <== (-e use v6.e.PREVIEW; dd ^10 .map: { last slip(42,66) if $_ == 5; $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
@melezhik
Copy link
Author

for bigger iterations:

2021.07 VS new-disp version:

[performace_01] :: ===
[performace_01] :: (0, 1, 2, 3, 4, 42, 66).Seq
[performace_01] :: time: 0.0046499
[performace_01] ::  <== (-e use v6.e.PREVIEW; dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
[performace_01] :: (0, 1, 2, 3, 4, 42, 66).Seq
[performace_01] :: time: 0.0178877
[performace_01] ::  <== (-e use v6.e.PREVIEW; dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)

@lizmat
Copy link
Contributor

lizmat commented Sep 14, 2021

new-disp still basically does not do any inlining. Until it does, performance is going to be sub-optimal.

@lizmat lizmat added the new-disp A bug specific to the new-disp branch label Sep 14, 2021
@melezhik
Copy link
Author

so you mean, it's better to check by running Raku code straight, not as raku -e ?

@lizmat
Copy link
Contributor

lizmat commented Sep 14, 2021

No, I'm saying it is no news that new-disp has performance issues. And that basically there is little point in this issue until @jnthn has indicated that performance on the new-disp branch is comparable to the master branch.

@melezhik
Copy link
Author

ok. anyway, when run the last test as raku code straight, times are comparable ... , not like when one runs as raku -e

@lizmat
Copy link
Contributor

lizmat commented Sep 14, 2021

THAT I find strange. Are you sure when you run as raku code "straight" as you say, you are in fact using the new-disp branch?

@melezhik
Copy link
Author

yes. here is what I get. however, my system rakudo ( 2021.07 ) is faster then new-disp version:

0.0055874 VS 0.0112757

maybe this ok ...

[root@6dc662692940 r3tool]# tomty --env=system performance_02
load configuration from /root/projects/r3tool/.tomty/env/config.system.pl6
[repository] :: index updated from file:///root/repo/api/v1/index
[performance_02] :: cat $root_dir/task.bash
[performance_02] ::
[performance_02] :: $RAKUBIN -v
[performance_02] ::
[performance_02] :: cat << 'HERE' > $cache_dir/code.raku
[performance_02] ::
[performance_02] :: use v6.e.PREVIEW;
[performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ };
[performance_02] :: say "time: ", now - INIT now;
[performance_02] ::
[performance_02] :: HERE
[performance_02] ::
[performance_02] :: $RAKUBIN $cache_dir/code.raku
[performance_02] :: Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2021.07.
[performance_02] :: Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
[performance_02] :: Built on MoarVM version 2021.07.
[performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
[performance_02] :: time: 0.0055874
[root@6dc662692940 r3tool]# tomty --env=source performance_02
load configuration from /root/projects/r3tool/.tomty/env/config.source.pl6
[repository] :: index updated from file:///root/repo/api/v1/index
[performance_02] :: cat $root_dir/task.bash
[performance_02] ::
[performance_02] :: $RAKUBIN -v
[performance_02] ::
[performance_02] :: cat << 'HERE' > $cache_dir/code.raku
[performance_02] ::
[performance_02] :: use v6.e.PREVIEW;
[performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ };
[performance_02] :: say "time: ", now - INIT now;
[performance_02] ::
[performance_02] :: HERE
[performance_02] ::
[performance_02] :: $RAKUBIN $cache_dir/code.raku
[performance_02] :: Welcome to 𝐨𝐚𝐤𝐮𝐝𝐑™ v2021.08-169-g16142c71c.
[performance_02] :: Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
[performance_02] :: Built on MoarVM version 2021.08-514-g32e0c279f.
[performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
[performance_02] :: time: 0.0112757

@jnthn
Copy link
Member

jnthn commented Sep 14, 2021

And that basically there is little point in this issue until @jnthn has indicated that performance on the new-disp branch is comparable to the master branch.

It's going to be far more complex than that, alas.

Soon we'll reach a point where the obvious missing optimizations that we depend heavily on have been reinstated and debugged. The key optimization still being pieced back together is inlining: when nearly every operator is at the minimum a multiple dispatch (and many then do a further method call), Raku peak performance is hugely reliant on it. Thus for now any measurements of peak performance (large numbers of iterations, enough the specializer/JIT get their hands on it) are liable to be underwhelming. I expect we'll look much better on that front by next week (maybe this week if things go really well).

However, even inlining rates in the profiler aren't going to be easily comparable. For example, take applying sink context. The majority of the time the sink method call goes to the one in Mu, which inlines away to almost nothing. In many programs that contributes quite a lot to the inlined frame count. But with new-disp we can use a dispatcher to look at if the method call on that type would be the Mu one and turn it into just producing the Nil constant value, which is discarded if we're truly in void context. We don't even reach the point of having something to inline away.

More broadly, new-disp takes a very different strategy to master. Of note:

  • Caching moves to per callsite rather than per callee (the multi cache) or per type (the flattened method hash precalculated and hung off every type).
  • We implement dispatch semantics, and explaining them to the VM, entirely in userspace now, rather than having some of them baked into the VM. For example, the VM no longer knows what a method call or a multi dispatch is. It just sees what types have to be present for us to determine a given result.

There will be significant wins for a wide range of language constructs immediately, and a bunch of new optimization opportunities opened up to us in the future, which is great. For the monomorphic majority of method and multi dispatches (that is, a given program point always calls the same target at runtime), peak performance should be little different from master. For lightly polymorphic sites, I'd expect us to do a little better initially (because we can chug through a bunch of simple type comparisons - just pointer comparisons - quicker than doing a hash lookup), and potentially much better later.

However, we're going to pay somewhat for the new flexibility in warm-up time; small numbers of iterations are liable to be a bit slower, primarily because the first iteration is likely going to be a bit slower, because we're doing some more setup work the first time we hit each method call or multiple dispatch. (We're also liable to find some megamorphic points in programs a bit more painful at first, because the previous strategy was a bit better for them, however there's already some work on coping with those better.)

@lizmat
Copy link
Contributor

lizmat commented Feb 17, 2022

@melezhik Could you retest and see if this is still an issue

@melezhik
Copy link
Author

@lizmat sure, I will try to do it a bit latter, sorry, quite busy at the moment

@melezhik
Copy link
Author

@lizmat I would say now, v2022.02 and new-disp (2022.02-42-gc935e681b) have comparable times for my test:

HTH

$ tomty --env=system performance_02
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.system.pl6
02:38:23 03/19/2022 [repository] :: index updated from http://sparrowhub.io/repo/api/v1/index
02:38:23 03/19/2022 [performance_02] :: cat $root_dir/task.bash
02:38:23 03/19/2022 [performance_02] :: 
02:38:23 03/19/2022 [performance_02] :: $RAKUBIN -v
02:38:23 03/19/2022 [performance_02] :: 
02:38:23 03/19/2022 [performance_02] :: cat << 'HERE' > $cache_dir/code.raku
02:38:23 03/19/2022 [performance_02] :: 
02:38:23 03/19/2022 [performance_02] :: use v6.e.PREVIEW; 
02:38:23 03/19/2022 [performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; 
02:38:23 03/19/2022 [performance_02] :: say "time: ", now - INIT now; 
02:38:23 03/19/2022 [performance_02] :: 
02:38:23 03/19/2022 [performance_02] :: HERE
02:38:23 03/19/2022 [performance_02] :: 
02:38:23 03/19/2022 [performance_02] :: $RAKUBIN $cache_dir/code.raku
02:38:23 03/19/2022 [performance_02] :: Welcome to Rakudo™ v2022.02.
02:38:23 03/19/2022 [performance_02] :: Implementing the Raku® Programming Language v6.d.
02:38:23 03/19/2022 [performance_02] :: Built on MoarVM version 2022.02.
02:38:23 03/19/2022 [performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
02:38:23 03/19/2022 [performance_02] :: time: 0.010762012

$ tomty --env=source performance_02
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.source.pl6
02:38:42 03/19/2022 [repository] :: index updated from http://sparrowhub.io/repo/api/v1/index
02:38:42 03/19/2022 [performance_02] :: cat $root_dir/task.bash
02:38:42 03/19/2022 [performance_02] :: 
02:38:43 03/19/2022 [performance_02] :: $RAKUBIN -v
02:38:43 03/19/2022 [performance_02] :: 
02:38:43 03/19/2022 [performance_02] :: cat << 'HERE' > $cache_dir/code.raku
02:38:43 03/19/2022 [performance_02] :: 
02:38:43 03/19/2022 [performance_02] :: use v6.e.PREVIEW; 
02:38:43 03/19/2022 [performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; 
02:38:43 03/19/2022 [performance_02] :: say "time: ", now - INIT now; 
02:38:43 03/19/2022 [performance_02] :: 
02:38:43 03/19/2022 [performance_02] :: HERE
02:38:43 03/19/2022 [performance_02] :: 
02:38:43 03/19/2022 [performance_02] :: $RAKUBIN $cache_dir/code.raku
02:38:43 03/19/2022 [performance_02] :: Welcome to Rakudo™ v2022.02-117-g8d284d8c1.
02:38:43 03/19/2022 [performance_02] :: Implementing the Raku® Programming Language v6.d.
02:38:43 03/19/2022 [performance_02] :: Built on MoarVM version 2022.02-42-gc935e681b.
02:38:43 03/19/2022 [performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
02:38:43 03/19/2022 [performance_02] :: time: 0.00917438

$ tomty --env=system performance_02
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.system.pl6
02:38:49 03/19/2022 [repository] :: index updated from http://sparrowhub.io/repo/api/v1/index
02:38:49 03/19/2022 [performance_02] :: cat $root_dir/task.bash
02:38:49 03/19/2022 [performance_02] :: 
02:38:49 03/19/2022 [performance_02] :: $RAKUBIN -v
02:38:49 03/19/2022 [performance_02] :: 
02:38:49 03/19/2022 [performance_02] :: cat << 'HERE' > $cache_dir/code.raku
02:38:49 03/19/2022 [performance_02] :: 
02:38:49 03/19/2022 [performance_02] :: use v6.e.PREVIEW; 
02:38:49 03/19/2022 [performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; 
02:38:49 03/19/2022 [performance_02] :: say "time: ", now - INIT now; 
02:38:49 03/19/2022 [performance_02] :: 
02:38:49 03/19/2022 [performance_02] :: HERE
02:38:49 03/19/2022 [performance_02] :: 
02:38:49 03/19/2022 [performance_02] :: $RAKUBIN $cache_dir/code.raku
02:38:49 03/19/2022 [performance_02] :: Welcome to Rakudo™ v2022.02.
02:38:49 03/19/2022 [performance_02] :: Implementing the Raku® Programming Language v6.d.
02:38:49 03/19/2022 [performance_02] :: Built on MoarVM version 2022.02.
02:38:49 03/19/2022 [performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
02:38:49 03/19/2022 [performance_02] :: time: 0.008735082

$ tomty --env=source performance_02
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.source.pl6
02:38:54 03/19/2022 [repository] :: index updated from http://sparrowhub.io/repo/api/v1/index
02:38:54 03/19/2022 [performance_02] :: cat $root_dir/task.bash
02:38:54 03/19/2022 [performance_02] :: 
02:38:54 03/19/2022 [performance_02] :: $RAKUBIN -v
02:38:54 03/19/2022 [performance_02] :: 
02:38:54 03/19/2022 [performance_02] :: cat << 'HERE' > $cache_dir/code.raku
02:38:54 03/19/2022 [performance_02] :: 
02:38:54 03/19/2022 [performance_02] :: use v6.e.PREVIEW; 
02:38:54 03/19/2022 [performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; 
02:38:54 03/19/2022 [performance_02] :: say "time: ", now - INIT now; 
02:38:54 03/19/2022 [performance_02] :: 
02:38:54 03/19/2022 [performance_02] :: HERE
02:38:54 03/19/2022 [performance_02] :: 
02:38:54 03/19/2022 [performance_02] :: $RAKUBIN $cache_dir/code.raku
02:38:54 03/19/2022 [performance_02] :: Welcome to Rakudo™ v2022.02-117-g8d284d8c1.
02:38:54 03/19/2022 [performance_02] :: Implementing the Raku® Programming Language v6.d.
02:38:54 03/19/2022 [performance_02] :: Built on MoarVM version 2022.02-42-gc935e681b.
02:38:54 03/19/2022 [performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
02:38:54 03/19/2022 [performance_02] :: time: 0.008358417

$ tomty --env=system performance_02
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.system.pl6
02:39:02 03/19/2022 [repository] :: index updated from http://sparrowhub.io/repo/api/v1/index
02:39:02 03/19/2022 [performance_02] :: cat $root_dir/task.bash
02:39:02 03/19/2022 [performance_02] :: 
02:39:02 03/19/2022 [performance_02] :: $RAKUBIN -v
02:39:02 03/19/2022 [performance_02] :: 
02:39:02 03/19/2022 [performance_02] :: cat << 'HERE' > $cache_dir/code.raku
02:39:02 03/19/2022 [performance_02] :: 
02:39:02 03/19/2022 [performance_02] :: use v6.e.PREVIEW; 
02:39:03 03/19/2022 [performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; 
02:39:03 03/19/2022 [performance_02] :: say "time: ", now - INIT now; 
02:39:03 03/19/2022 [performance_02] :: 
02:39:03 03/19/2022 [performance_02] :: HERE
02:39:03 03/19/2022 [performance_02] :: 
02:39:03 03/19/2022 [performance_02] :: $RAKUBIN $cache_dir/code.raku
02:39:03 03/19/2022 [performance_02] :: Welcome to Rakudo™ v2022.02.
02:39:03 03/19/2022 [performance_02] :: Implementing the Raku® Programming Language v6.d.
02:39:03 03/19/2022 [performance_02] :: Built on MoarVM version 2022.02.
02:39:03 03/19/2022 [performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
02:39:03 03/19/2022 [performance_02] :: time: 0.009246768

$ tomty --env=source performance_02
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.source.pl6
02:39:06 03/19/2022 [repository] :: index updated from http://sparrowhub.io/repo/api/v1/index
02:39:06 03/19/2022 [performance_02] :: cat $root_dir/task.bash
02:39:06 03/19/2022 [performance_02] :: 
02:39:06 03/19/2022 [performance_02] :: $RAKUBIN -v
02:39:06 03/19/2022 [performance_02] :: 
02:39:06 03/19/2022 [performance_02] :: cat << 'HERE' > $cache_dir/code.raku
02:39:06 03/19/2022 [performance_02] :: 
02:39:06 03/19/2022 [performance_02] :: use v6.e.PREVIEW; 
02:39:06 03/19/2022 [performance_02] :: dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; 
02:39:06 03/19/2022 [performance_02] :: say "time: ", now - INIT now; 
02:39:06 03/19/2022 [performance_02] :: 
02:39:06 03/19/2022 [performance_02] :: HERE
02:39:06 03/19/2022 [performance_02] :: 
02:39:06 03/19/2022 [performance_02] :: $RAKUBIN $cache_dir/code.raku
02:39:06 03/19/2022 [performance_02] :: Welcome to Rakudo™ v2022.02-117-g8d284d8c1.
02:39:06 03/19/2022 [performance_02] :: Implementing the Raku® Programming Language v6.d.
02:39:06 03/19/2022 [performance_02] :: Built on MoarVM version 2022.02-42-gc935e681b.
02:39:06 03/19/2022 [performance_02] :: stderr: (0, 1, 2, 3, 4, 42, 66).Seq
02:39:06 03/19/2022 [performance_02] :: time: 0.009178201

@melezhik
Copy link
Author

another comparison between 2022.02 and new-disp, might be of interest, in most of the cases new-disp is slightly faster except the case in the middle:

$ RAKUBIN2=$(which raku) tomty --env=source performace_01
load configuration from /Users/melezhik/projects/r3tool/.tomty/env/config.source.pl6
index updated from http://sparrowhub.io/repo/api/v1/index
first candidate:  Welcome to Rakudo™ v2022.02-117-g8d284d8c1. Implementing the Raku® Programming Language v6.d. Built on MoarVM version 2022.02-42-gc935e681b.
second candidate:  Welcome to Rakudo™ v2022.02. Implementing the Raku® Programming Language v6.d. Built on MoarVM version 2022.02.
==========================================
time: 0.000392035
 <== (-e say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
time: 0.000420955
 <== (-e say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(0 1 2 3 4)
time: 0.005736988
 <== (-e say ^10 .map: { $_ == 5 ?? (last)   !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0 1 2 3 4)
time: 0.00593847
 <== (-e say ^10 .map: { $_ == 5 ?? (last)   !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(0 1 2 3 4 42)
time: 0.004688277
 <== (-e use v6.e.PREVIEW; say ^10 .map: { $_ == 5 ?? last(42) !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0 1 2 3 4 42)
time: 0.005023861
 <== (-e use v6.e.PREVIEW; say ^10 .map: { $_ == 5 ?? last(42) !! $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(0 2 4)
time: 0.006324657
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? (last)  !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0 2 4)
time: 0.004964456
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? (last) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(0 2 4)
time: 0.005020268
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last()  !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0 2 4)
time: 0.005533028
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last() !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(0 2 4 5)
time: 0.005495457
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last(True) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0 2 4 5)
time: 0.005398942
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? last(True) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(1 2 3 4)
time: 0.004744068
 <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? (last) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(1 2 3 4)
time: 0.004230027
 <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? (last) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(1 2 3 4 42)
time: 0.004599052
 <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? last(42) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(1 2 3 4 42)
time: 0.004535519
 <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? last(42) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===
(0, 1, 2, 3, 4, 42, 66).Seq
time: 0.008303474
 <== (-e use v6.e.PREVIEW; dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0, 1, 2, 3, 4, 42, 66).Seq
time: 0.008335209
 <== (-e use v6.e.PREVIEW; dd ^10000 .map: { last slip(42,66) if $_ == 5; $_ }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)

@melezhik
Copy link
Author

so for this only case new-disp is slower then 2022.02: 🤔

0 2 4)
time: 0.006324657
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? (last)  !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(0 2 4)
time: 0.004964456
 <== (-e use v6.e.PREVIEW; say ^10 .grep: { $_ == 5 ?? (last) !! $_ %% 2 }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)

@melezhik
Copy link
Author

and probably for this one:

(1 2 3 4)
time: 0.004744068
 <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? (last) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
(1 2 3 4)
time: 0.004230027
 <== (-e use v6.e.PREVIEW; my $i; say do while ++$i < 10 { $i == 5 ?? (last) !! $i }; say "time: ", now - INIT now; say " <== ", Rakudo::Internals.PROGRAM)
===

@MasterDuke17
Copy link
Contributor

Those are doing so little work inside them that they're mostly measuring startup, which is known to be slightly slower after new-disp.

@coke
Copy link
Collaborator

coke commented Mar 26, 2024

I believe this is now safe to close. Please open any other performance issues against main.

@coke coke closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-disp A bug specific to the new-disp branch
Projects
None yet
Development

No branches or pull requests

5 participants