[svn:parrot] r45712 - branches/compact_pool_revamp/examples/benchmarks

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Apr 16 15:17:48 UTC 2010


Author: bacek
Date: Fri Apr 16 15:17:48 2010
New Revision: 45712
URL: https://trac.parrot.org/parrot/changeset/45712

Log:
Add GC strings stress test.

Added:
   branches/compact_pool_revamp/examples/benchmarks/stress_strings.pir

Added: branches/compact_pool_revamp/examples/benchmarks/stress_strings.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/compact_pool_revamp/examples/benchmarks/stress_strings.pir	Fri Apr 16 15:17:48 2010	(r45712)
@@ -0,0 +1,43 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+examples/benchmarks/stress_strings.pir - GC strings stress-testing
+
+=head1 SYNOPSIS
+
+    % time ./parrot examples/benchmarks/stress_strings.pir
+
+=head1 DESCRIPTION
+
+Create a lots of strings. Some of them are long-lived, most of them are short lived.
+
+Main purpose - test compact_pool performance.
+
+=cut
+
+.sub 'main' :main
+    .local pmc rsa # array of long lived strings.
+
+    .local int i
+
+    rsa = new ['ResizableStringArray']
+    i = 0
+  loop:
+    $S0 = i         # allocate new string
+    $I0 = i % 10    # every 10th string is longlived
+    if $I0 goto inc_i
+    push rsa, $S0
+  inc_i:
+    inc i
+    if i < 10000000 goto loop
+
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list