Skip to content

Commit 3f8187a

Browse files
committed
Formatted benchmark table to be better aligned.
1 parent 3de5d3c commit 3f8187a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

bench.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end
2929
function BenchmarkEnd(start_time)
3030
local t = os.clock() - start_time
3131
local m, s = math.floor(t / 60), (t % 60)
32-
io.write(string.format("%6d:%010.7f\n", m, s))
32+
io.write(string.format("%7d:%09.6f\n", m, s))
3333
end
3434

3535
local function benchmark_pi()
@@ -146,7 +146,7 @@ end
146146
-- Some information
147147
print("Interpreter:", _VERSION)
148148
print("System Family:", SystemFamily())
149-
print("Memory (KB):", collectgarbage("count"))
149+
print("Memory Used:", string.format("%.3fkB", collectgarbage("count")))
150150
print("Minimum Int:", math.mininteger or "Unknown")
151151
print("Maximum Int:", math.maxinteger or "Unknown")
152152
print()
@@ -165,8 +165,6 @@ benchmark_pi()
165165
benchmark_gcd()
166166

167167
benchmark_array()
168-
169-
print()
170-
print("Total memory usage (KB):", collectgarbage("count"))
171-
io.write("Total benchmark seconds:\t")
168+
print(string.rep('_', 49))
169+
io.write("Total:\t\t" .. string.format("%8.3fkB", collectgarbage("count")) .. "\t")
172170
BenchmarkEnd(bm)

0 commit comments

Comments
 (0)