Commits

Miki Tebeka committed e7f63c4

More flex and size dynamically

Comments (0)

Files changed (1)

             return full
 
 
-def simple(name):
+def script(name, *command):
     full = which(name)
     assert full, "can't find %s" % name
 
-    return { "name" : name.title(), "command" : [full, "/dev/null"]}
+    command = list(command) if command else ["/dev/null"]
+
+    return { "name" : name.title(), "command" : [full] + command}
 
 scripts = [
-    simple("python"),
-    simple("ruby"),
-    simple("perl"),
+    script("python"),
+    script("ruby"),
+    script("perl"),
+    script("newlisp", "-e", "'(exit)'")
 ]
 
 def timeit(command):
     start = time()
-    call(command, shell=0)
+    with open("/dev/null", "wb") as fo:
+        call(command, shell=0, stdout=fo)
     end = time()
 
     return end - start
         start = time()
         runtimes.append((timeit(script["command"]), script["name"]))
 
+    maxlen = max((len(rt[1]) for rt in runtimes)) + 1
     runtimes.sort()
     for runtime, name in runtimes:
-        print "%-7s: %f" % (name, runtime)
+        print "%-*s: %f" % (maxlen, name, runtime)
 
 if __name__ == "__main__":
     run()