Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[GH #837] New comparison benchmark against stress_stringsu.pir

Bad news:
There is almost no measurable speed advantage from ascii strings to encoded strings.
With the fix and without the fix, as sprintf handling slows down the test 4x times.

So converting a SREG and const to encoded STRING* will not gain much performance.
  • Loading branch information...
commit 9c8159314dd2d26365653fbcd8627b0f8fbb0559 1 parent e82482e
@rurban rurban authored
Showing with 47 additions and 0 deletions.
  1. +47 −0 examples/benchmarks/stress_strings1.pir
View
47 examples/benchmarks/stress_strings1.pir
@@ -0,0 +1,47 @@
+# Copyright (C) 2010-2012, Parrot Foundation.
+
+=head1 NAME
+
+examples/benchmarks/stress_strings1.pir - comparison with stress_stringsu.pir
+
+=head1 SYNOPSIS
+
+ % time ./parrot examples/benchmarks/stress_strings1.pir
+ % time ./parrot examples/benchmarks/stress_stringsu.pir
+
+=head1 DESCRIPTION
+
+Create non-encoded strings, running through the imcc optimizer.
+Some of the strings are long-lived, most of them are short lived.
+
+=cut
+
+.sub 'main' :main
+ .local pmc rsa # array of long lived strings.
+ .local pmc args
+ .local int i
+
+ rsa = new ['ResizableStringArray']
+ args = new ['ResizablePMCArray']
+ i = 0
+ push args, i
+ loop:
+ $S0 = "c"
+ args[0] = i
+ sprintf $S1, "%d", args
+ $S2 = concat $S0, $S1
+ $I0 = i % 10 # every 10th string is longlived
+ if $I0 goto inc_i
+ push rsa, $S2
+ inc_i:
+ inc i
+ if i < 10000000 goto loop
+
+.end
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Please sign in to comment.
Something went wrong with that request. Please try again.