4 ms·
Here is how spitbol script measures against wc. As with k, I am lacking in spitbol experience and so the counts are not identical to wc. Also I am using 10MB
by textmode 8y ago
Here is how spitbol script measures against wc.
As with k, I am lacking in spitbol experience and so the counts are not identical to wc. Also I am using 10MB of big10.txt instead of the entire file.
1.spt:
;* m line count, c word count, o char count
;* p word pattern
; n = "0123456789"
; w = n &ucase &lcase "-"
; p = break(w) span(w)
;a a = input :f(c)
; o = o + size(a)
; m = m + 1
;b a ? p = :f(a)
; c = c + 1 :(b)
;c output = m ' ' c ' ' o
;end
dd if=big10.txt bs=5m count=2 of=10m.txt
time -p wc 10m.txt
201346 1763181 10485760 10m.txt
real 0.51
user 0.44
sys 0.00
time -p spitbol 1.spt < 10m.txt
201347 1770831 10235302
real 0.33
user 0.31
sys 0.01
It appears that spitbol script is faster than wc.