Explorar el Código

Upgrade the script pkg/persistent/add-slowdown.

Qi Xiao hace 2 años
padre
commit
b2c6e41cb2
Se han modificado 1 ficheros con 9 adiciones y 9 borrados
  1. 9 9
      pkg/persistent/add-slowdown

+ 9 - 9
pkg/persistent/add-slowdown

@@ -4,30 +4,30 @@
 # counterparts.
 use re
 
-fn extract [line]{
+fn extract {|line|
     # Extract the name and ns/op of a benchmark entry.
-    fields = [(re:split '\s+' $line)]
+    var fields = [(re:split '\s+' $line)]
     if (not (eq $fields[-1] ns/op)) {
         fail 'Last column of '(repr $line)' not ns/op'
     }
     put $fields[0] $fields[-2]
 }
 
-native = [&]
+var native = [&]
 
-each [line]{
+each {|line|
     if (re:match Native $line) {
         # Remember the result so that it can be used later.
-        name data = (extract $line)
-        native[$name] = $data
+        var name data = (extract $line)
+        set native[$name] = $data
     } elif (re:match Persistent $line) {
         # Calculate slowdown and append to the end of the line.
-        name data = (extract $line)
-        native-name = (re:replace Persistent Native $name)
+        var name data = (extract $line)
+        var native-name = (re:replace Persistent Native $name)
         if (not (has-key $native $native-name)) {
             fail 'Native counterpart for '$name' not found'
         }
-        line = $line' '(printf '%.2f' (/ $data $native[$native-name]))'x'
+        set line = $line' '(printf '%.2f' (/ $data $native[$native-name]))'x'
     }
     echo $line
 }