[SCM] Lisaac compiler branch, master, updated. 647607a56cac9dfd7d09a523cf3c874c7fc8d6a3

Jeremy Cowgar jeremy at cowgar.com
Fri Jul 31 15:25:28 UTC 2009


The following commit has been merged in the master branch:
commit 647607a56cac9dfd7d09a523cf3c874c7fc8d6a3
Author: Jeremy Cowgar <jeremy at cowgar.com>
Date:   Fri Jul 31 11:24:02 2009 -0400

    * Added an example program using the new TOOLS.bench slot. The program
      will benchmark any console program, for instance "bench ls *". This
      also allows us to benchmark a Lisaac program from start to finish,
      including initialization time.

diff --git a/example/bench/bench.li b/example/bench/bench.li
new file mode 100644
index 0000000..fda7634
--- /dev/null
+++ b/example/bench/bench.li
@@ -0,0 +1,28 @@
+Section Header
+
+  + name := BENCH;
+  - copyright := "(c) 2009 by Jeremy Cowgar";
+  - comment := "Benchmarks any console program";
+  
+Section Public
+
+  - main <-
+  ( + cmd:STRING;
+    + time:REAL_32;
+    
+    (COMMAND_LINE.upper = 0).if {
+      "Usage: bench program [command_line_option...]".println;
+      OBJECT.die_with_code 1;
+    };
+  
+    cmd := STRING.create 256;
+
+    1.to (COMMAND_LINE.upper) do { y:INTEGER;
+      cmd := cmd + (COMMAND_LINE.item y) + " ";
+    };
+
+    time := TOOLS.bench { ENVIRONMENT.execute_command cmd; };
+    
+    "Time: ".print;
+    time.println;
+  );

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list