Skip to content

Commit

Permalink
adjust point-class-add*
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuomingliang committed Jan 7, 2015
1 parent 90c07ed commit a2cd0bd
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 100 deletions.
10 changes: 10 additions & 0 deletions minibenchmarks.pl
Expand Up @@ -133,4 +133,14 @@
perl6 => [qw( BENCH/perl6/divide-and-conquer SCALE )],
nqp => undef,
},
{
name => 'point-class-add',
skip => [qw( )],
tags => [qw( stress attribute object-allocation multi-method)],
scale => 1 << 3,
expected => "650000001.5 950000002.5",
perl5 => undef,
perl6 => [qw( BENCH/perl6/point-class-add ), qw( BENCH/perl6/point-class-add1 ), qw( BENCH/perl6/point-class-add2 )],
nqp => [qw( BENCH/nqp/point-class-add ), qw( BENCH/nqp/point-class-add1 ), qw( BENCH/nqp/point-class-add2 ), qw( BENCH/nqp/point-class-add2-multi-method )],
},
]
19 changes: 5 additions & 14 deletions nqp/point_class_add
@@ -1,19 +1,10 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 1800+ NQP class NQP/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 1800+ NQP class NQP/MoarVM

# see perl6/point_class_add_README for more information

class Point {
has num $!x;
Expand All @@ -32,4 +23,4 @@ while $i < 100000000 {
$a := $a.add($b).add($b);
$i := $i + 1;
}
print($a.x, $a.y);
print($a.x, ' ', $a.y);
19 changes: 5 additions & 14 deletions nqp/point_class_add1
@@ -1,19 +1,10 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 700+ NQP class NQP/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 700+ NQP class NQP/MoarVM

# see perl6/point_class_add_README for more information

class Point {
has num $!x;
Expand All @@ -35,4 +26,4 @@ while $i < 100000000 {
$a := $a.add($b).add($b);
$i := $i + 1;
}
print($a.x, $a.y);
print($a.x, ' ', $a.y);
20 changes: 5 additions & 15 deletions nqp/point_class_add2
@@ -1,20 +1,10 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks
## Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 83 NQP class NQP/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 83 NQP class NQP/MoarVM

# see perl6/point_class_add_README for more information

class Point {
has num $!x;
Expand Down Expand Up @@ -49,4 +39,4 @@ while $i < 100000000 {
$a := $a.add($b).add($b);
$i := $i + 1;
}
print($a.x, $a.y);
print($a.x, ' ', $a.y);
18 changes: 4 additions & 14 deletions nqp/point_class_add2_multi_method
@@ -1,20 +1,10 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 150 NQP class NQP/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 150 NQP class NQP/MoarVM

# see perl6/point_class_add_README for more information

class Point {
has num $!x;
Expand Down Expand Up @@ -48,4 +38,4 @@ while $i < 100000000 {
$a := $a.add($b).add($b);
$i := $i + 1;
}
print($a.x, $a.y);
print($a.x, ' ', $a.y);
19 changes: 5 additions & 14 deletions perl6/point_class_add
@@ -1,19 +1,10 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 6600+ Perl6 class Rakudo/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 6600+ Perl6 class Rakudo/MoarVM

# see perl6/point_class_add_README for more information

use v6;

Expand All @@ -35,4 +26,4 @@ while $i < 100000000 {
$i = $i + 1;
}

print $a.x, $a.y;
print $a.x, ' ', $a.y;
19 changes: 5 additions & 14 deletions perl6/point_class_add1
@@ -1,19 +1,10 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 2500+ Perl6 class Rakudo/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 2500+ Perl6 class Rakudo/MoarVM

# see perl6/point_class_add_README for more information

use v6;

Expand All @@ -40,4 +31,4 @@ while $i < 100000000 {
$i = $i + 1;
}

print $a.x, $a.y;
print $a.x, ' ', $a.y;
23 changes: 8 additions & 15 deletions perl6/point_class_add2
@@ -1,27 +1,18 @@
# the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

# this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

# Point Class Benchmarks

# Here's the runtime for the point class in seconds (YMMV). Lower is better:
# Time Point object VM/Compiler
# 140.0 Lua table Lua 5.1.5
# 26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
# 10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
# 0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
# 0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
# 0.2 C++ class GCC 4.4.3 -O2 (or -O3)
# 1.2 Java class JVM/Hotspot 1.7.0_05
# 420+ Perl6 class Rakudo/MoarVM
# 0.22 Lua table LuaJIT 2.0 git HEAD -O+sink
# 420+ Perl6 class Rakudo/MoarVM

# see perl6/point_class_add_README for more information

use v6;

class Point {
has num $.x;
has num $.y;
method new(num $x, num $y) {
my Point $self := nqp::create(self);
my Point $self = nqp::create(self);
nqp::bindattr_n($self, Point, '$!x', $x);
nqp::bindattr_n($self, Point, '$!y', $y);

Expand All @@ -35,8 +26,10 @@ class Point {
my int $i = 0;
my Point $a = Point.new(1.5e0, 2.5e0);
my Point $b = Point.new(3.25e0, 4.75e0);

while $i < 100000000 {
$a = $a.add($b).add($b);
$i = $i + 1;
}
print $a.x, $a.y;

print $a.x, ' ', $a.y;
17 changes: 17 additions & 0 deletions perl6/point_class_add_README
@@ -0,0 +1,17 @@
the code is ported from: http://wiki.luajit.org/Allocation-Sinking-Optimization

this benchmark is useful for Allocation Sinking Optimization or Escape Analysis Optimization

Point Class Benchmarks

Here's the runtime for the point class in seconds (YMMV). Lower is better:
Time Point object VM/Compiler
140 Lua table Lua 5.1.5
26.9 Lua table LuaJIT 2.0 git HEAD -O-sink
10.9 FFI struct LuaJIT 2.0 git HEAD -O-sink
0.2 Lua table LuaJIT 2.0 git HEAD -O+sink
0.2 FFI struct LuaJIT 2.0 git HEAD -O+sink
0.2 C++ class GCC 4.4.3 -O2 (or -O3)
1.2 Java class JVM/Hotspot 1.7.0_05

NOTE: the above is from Mike Pall.

0 comments on commit a2cd0bd

Please sign in to comment.