Skip to content
Browse files

Make bitops inlinable

  • Loading branch information...
1 parent 2825023 commit c49e30c299bed7357411bc8256346bb7c288881a @sorear committed May 30, 2011
Showing with 12 additions and 10 deletions.
  1. +0 −4 perf/perf.TODO
  2. +6 −6 perf/std-20110528.pl6
  3. +6 −0 src/NieczaPassSimplifier.pm6
View
4 perf/perf.TODO
@@ -7,14 +7,10 @@ Experiment with "if non-overriden, then replace method" hooks
Experiment with making P6any: Variable
-push, shift, etc off-loop?
-
Avoid calling a function for trivial attribute (or parameter) defaults
Improve isa, somehow.
-Subquadratic nibbling. Also improve nibbler's use of GetKey and push.
-
Reduce redundant Cursor creation for, e.g., { say 2 }
Reduce ContextHelper use in ws, or make it faster.
View
12 perf/std-20110528.pl6
@@ -20,9 +20,9 @@ sub bench($name, $nr, $f) {
my @arr;
-bench "(zeroing array)", 100000, sub () { @arr = () };
-bench "(tenning array)", 100000, sub () { @arr = 0,1,2,3,4,5,6,7,8,9 };
-bench "push", 100000, sub () { @arr = (); push @arr, 1; push @arr, 2; push @arr, 3; push @arr, 4; push @arr, 5; push @arr, 6; push @arr, 7; push @arr, 8; push @arr, 9; push @arr, 10; };
-bench "unshift", 100000, sub () { @arr = (); unshift @arr, 1; unshift @arr, 2; unshift @arr, 3; unshift @arr, 4; unshift @arr, 5; unshift @arr, 6; unshift @arr, 7; unshift @arr, 8; unshift @arr, 9; unshift @arr, 10; };
-bench "pop", 100000, sub () { @arr = 0,1,2,3,4,5,6,7,8,9; pop @arr; pop @arr; pop @arr; pop @arr; pop @arr; pop @arr; pop @arr; pop @arr; pop @arr; pop @arr };
-bench "shift", 100000, sub () { @arr = 0,1,2,3,4,5,6,7,8,9; shift @arr; shift @arr; shift @arr; shift @arr; shift @arr; shift @arr; shift @arr; shift @arr; shift @arr; shift @arr };
+bench "or", 10000000, sub () { 1 +| 2 };
+bench "xor", 10000000, sub () { 1 +^ 2 };
+bench "and", 10000000, sub () { 1 +& 2 };
+bench "lshift", 10000000, sub () { 1 +> 2 };
+bench "rshift", 10000000, sub () { 1 +< 2 };
+bench "compl", 10000000, sub () { +^ 1 };
View
6 src/NieczaPassSimplifier.pm6
@@ -79,6 +79,12 @@ our %funcs = (
'&infix:<<>' => do_builtin('numlt', 2),
'&infix:<!=>' => do_builtin('numne', 2),
'&infix:<+>' => do_builtin('plus', 2),
+ '&infix:<+&>' => do_builtin('numand', 2),
+ '&infix:<+|>' => do_builtin('numor', 2),
+ '&infix:<+^>' => do_builtin('numxor', 2),
+ '&infix:<+<>' => do_builtin('numlshift', 2),
+ '&infix:<+>>' => do_builtin('numrshift', 2),
+ '&prefix:<+^>' => do_builtin('numcompl', 1),
'&last' => do_nullary_control(2),
'&make' => do_builtin('make', 1),
'&map' => &do_map_grep,

0 comments on commit c49e30c

Please sign in to comment.
Something went wrong with that request. Please try again.