Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created December 5, 2020 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Whateverable/9177f3864738a3cc95e015c0eb6a41c7 to your computer and use it in GitHub Desktop.
Save Whateverable/9177f3864738a3cc95e015c0eb6a41c7 to your computer and use it in GitHub Desktop.
bisectable6
my @needles = "foo"; do given any(@needles) { when "foo" { say "OK" }; default { say "wut" }; };
Bisecting: 46 revisions left to test after this (roughly 6 steps)
[e90ed75796775561a1b4515f57c8b4855e082015] Merge pull request #4064 from rakudo/fix-compiler-services-concurrency-issue
»»»»» Testing e90ed75796775561a1b4515f57c8b4855e082015
»»»»» Script output:
OK
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is identical
»»»»» Therefore, marking this revision as “old”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 912381b717a2691654431c5d8a70628d4e408427
»»»»» Script output:
wut
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 3d8e942f0797765511c13e971803421e4d9bf21c
»»»»» Script output:
OK
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is identical
»»»»» Therefore, marking this revision as “old”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 260f015888c71b92a5333672336e70c74f538b38
»»»»» Script output:
wut
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 734631b678897345ab978b7bf493385020db8b76
»»»»» Script output:
OK
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is identical
»»»»» Therefore, marking this revision as “old”
»»»»» -------------------------------------------------------------------------
»»»»» Testing 0006475ad0d28a9325d63f5dba73437649987bfd
»»»»» Script output:
wut
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
»»»»» -------------------------------------------------------------------------
»»»»» Testing c080e59404ed1b27e8841249e1c71d7e013c09ca
»»»»» Script output:
wut
»»»»» Script exit code: 0
»»»»» Bisecting by output
»»»»» Output on “old” revision is:
OK
»»»»» The output is different
»»»»» Therefore, marking this revision as “new”
c080e59404ed1b27e8841249e1c71d7e013c09ca is the first new commit
commit c080e59404ed1b27e8841249e1c71d7e013c09ca
Author: Daniel Green <ddgreen@gmail.com>
Date: Fri Nov 13 16:22:56 2020 -0500
Gen faster code for some kinds of `when` cases
If it's a type or literal, we don't need to do a full smartmatch.
Unfortunately this isn't dramatically faster, since the primary cost is
in generating a Backtrace for the Failure created when a case doesn't
match.
An example test case:
```raku
my $a;
my @a = 1, 5, Int, "hi", "bye", 50, Complex;
my $s = now;
for ^100_000 -> $i {
$a = do given @a[$i % 7] {
when Int { "Int" }
when 5 { "five" }
when "hi" { "hello" }
default { "default" }
}
};
say now - $s;
say $a
```
takes ~1.4s with this change, ~1.8s before.
:040000 040000 0dff6dfe438fd3eb758863cc30a80b8ba81b24bf f0da2e86bb295c2eb7d6b579f24a9a03fae7b789 M src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment