Skip to content

Commit

Permalink
Run my little hyperfine performance regression tester
Browse files Browse the repository at this point in the history
Other small things
- Add a script for generating a nice graph
- Modify the equality script to not have useless fluff
- Cleanup some old files
  • Loading branch information
rctcwyvrn committed Aug 24, 2020
1 parent ae5dff4 commit 20032cc
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 28 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/target
gc_bench.py
/bench/
/.vscode
/fuzz/artifacts
Expand Down
Binary file added benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions generate_graph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import matplotlib.pyplot as plt
import csv
import glob

legend = []
for file in glob.glob("./results/hyperfine/*/*.csv"):
dates = []
means = []
name = file.split("/")[-2]
with open(file) as csv_file:
reader = csv.DictReader(csv_file)
last_date = None
for row in reader:
means.append(float(row['mean']))
if int(row['date']) == last_date:
dates.append(last_date + 0.1)
else:
dates.append(int(row['date']))

last_date = int(row['date'])
print(f"Plotting {name} | {dates} {means}")
# plt.plot(dates, means)
plt.plot(means)
legend.append(name)

print("Saving plot")
plt.legend(legend)
#plt.show()
plt.savefig("benchmarks.png")
1 change: 1 addition & 0 deletions results/hyperfine/binary_trees/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/binary_trees.lox,12.911781053499999,0.12789319008584024,12.873639573499998,12.848197724999997,0.045071155,12.7897239735,13.184036473499999
0821,a9f49ca6,target/release/rlox test/benchmark/binary_trees.lox,8.579481981499999,0.07484662100586514,8.556078051500002,8.50636141,0.055100769999999986,8.5035297515,8.7607937515
0823,ae5dff4f,target/release/rlox test/benchmark/binary_trees.lox,7.852915855499999,0.06254838529042923,7.8414998055,7.78984349,0.043958830000000004,7.7991108555,8.0164702555
3 changes: 1 addition & 2 deletions results/hyperfine/equality/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/equality.lox,23.593582642500003,0.1853940908105642,23.5665251625,23.56696771,0.0070719879999999995,23.4007326125,23.979339012500002
0821,a9f49ca6,target/release/rlox test/benchmark/equality.lox,20.4739113955,0.35652715094759463,20.3652368655,20.44470784,0.010982767999999999,20.1591409655,21.3592229655
ae5dff4f,0823,target/release/rlox test/benchmark/equality.lox,11.057686174999997,0.16886445210338774,11.012227305,11.031249445,0.009073987,10.933462655,11.518737755
1 change: 1 addition & 0 deletions results/hyperfine/fib/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/fib.lox,7.25422741,0.04322729976197396,7.2356177200000005,7.23229528,0.0029902479999999996,7.20690377,7.32920157
0821,a9f49ca6,target/release/rlox test/benchmark/fib.lox,6.182764388500001,0.03870299160582344,6.1847567485,6.16421783,0.0009980025,6.1263179485000006,6.2603585485
0823,ae5dff4f,target/release/rlox test/benchmark/fib.lox,4.342451284999999,0.020650874299662128,4.336064974999999,4.321701464999999,0.0029874559999999994,4.325081624999999,4.392839524999999
1 change: 1 addition & 0 deletions results/hyperfine/instantiation/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/instantiation.lox,4.3105603630000005,0.051432192149039005,4.287656693,4.284178245,0.007083052500000001,4.269894293,4.427316093
0821,a9f49ca6,target/release/rlox test/benchmark/instantiation.lox,3.8584743969999997,0.09229884050575177,3.825002727,3.83794727,0.001996881,3.816166377,4.117994077
0823,ae5dff4f,target/release/rlox test/benchmark/instantiation.lox,3.1387832145,0.025372884874301355,3.1292967445000004,3.1206470449999997,0.0,3.1100327445000002,3.1933306445
1 change: 1 addition & 0 deletions results/hyperfine/invocation/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/invocation.lox,3.5281578485000002,0.030079279964158413,3.5220932485,3.5072232249999997,0.00305841,3.4845299485,3.5713981485
0821,a9f49ca6,target/release/rlox test/benchmark/invocation.lox,3.1267161330000004,0.06932282357146483,3.108265523,3.1071154049999996,0.001990582,3.0838472730000004,3.319080673
0823,ae5dff4f,target/release/rlox test/benchmark/invocation.lox,2.4814605365,0.13223999370374098,2.4452007965,2.42512207,0.0009956284999999999,2.4193475465,2.8567294465
1 change: 1 addition & 0 deletions results/hyperfine/method_call/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/method_call.lox,2.0424147610000003,0.06670068902099888,2.016731521,2.02064377,0.001079144,1.993209221,2.214936421
0821,a9f49ca6,target/release/rlox test/benchmark/method_call.lox,1.834315736,0.02171958196253379,1.833958036,1.80882756,0.0040649779999999995,1.8082283860000001,1.8762188860000002
0823,ae5dff4f,target/release/rlox test/benchmark/method_call.lox,1.575945343,0.13102596449970813,1.5356185530000002,1.51299977,0.001994854,1.5210675530000002,1.947903053
1 change: 1 addition & 0 deletions results/hyperfine/properties/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/properties.lox,4.8859913184999995,0.033528904709500595,4.8827581585,4.865283659999999,0.0009955699999999999,4.8368941085,4.9488476084999995
0821,a9f49ca6,target/release/rlox test/benchmark/properties.lox,4.3271661015000005,0.029455540780369376,4.3198819215,4.307078245,0.00207346,4.2904542215,4.3819413215
0823,ae5dff4f,target/release/rlox test/benchmark/properties.lox,3.6230968235000005,0.041138971021696655,3.6107854535,3.60063249,0.0030659754999999996,3.5774184035000003,3.7217076035
1 change: 1 addition & 0 deletions results/hyperfine/string_equality/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/string_equality.lox,1.345820889,0.014380903363063718,1.342068539,1.3260492650000002,0.0009981935,1.329576989,1.369029989
0821,a9f49ca6,target/release/rlox test/benchmark/string_equality.lox,1.2011877990000002,0.059231398845140525,1.1784916390000002,1.181795165,0.0011321859999999999,1.164327289,1.3510744890000002
0823,ae5dff4f,target/release/rlox test/benchmark/string_equality.lox,1.1564698080000002,0.13336748869765042,1.111002628,1.095402165,0.0019938259999999998,1.1046188780000001,1.5352866780000003
1 change: 1 addition & 0 deletions results/hyperfine/trees/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/trees.lox,22.958459860499996,0.2588973323104744,22.922630460500002,22.88459836,0.0540756,22.6359024605,23.5410061605
0821,a9f49ca6,target/release/rlox test/benchmark/trees.lox,19.781800592499998,0.20728140500178466,19.736815002500002,19.726612505,0.03598268,19.553734052499998,20.3073476525
0823,ae5dff4f,target/release/rlox test/benchmark/trees.lox,18.015290424000003,0.0583475230645558,18.022432174000002,17.934327785,0.052095405000000004,17.907275824000003,18.137240424
1 change: 1 addition & 0 deletions results/hyperfine/zoo/res.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
date,hash,command,mean,stddev,median,user,system,min,max
0821,22bdce67,target/release/rlox test/benchmark/zoo.lox,3.5880924379999994,0.03129605276251831,3.5719926280000003,3.5694763800000002,0.000201951,3.565934928,3.655301528
0821,a9f49ca6,target/release/rlox test/benchmark/zoo.lox,3.2796371740000003,0.18186907873021188,3.223001184,3.258808605,0.001990418,3.1722076340000003,3.7917005340000003
0823,ae5dff4f,target/release/rlox test/benchmark/zoo.lox,2.7237645775,0.02150876722760334,2.7206168474999997,2.7061678149999997,0.0,2.6992780475,2.7644524475
25 changes: 0 additions & 25 deletions test/benchmark/equality.lox
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
var i = 0;

var loopStart = clock();

while (i < 10000000) {
i = i + 1;

1; 1; 1; 2; 1; nil; 1; "str"; 1; true;
nil; nil; nil; 1; nil; "str"; nil; true;
true; true; true; 1; true; false; true; "str"; true; nil;
"str"; "str"; "str"; "stru"; "str"; 1; "str"; nil; "str"; true;
}

var loopTime = clock() - loopStart;

var start = clock();

i = 0;
while (i < 10000000) {
i = i + 1;

Expand All @@ -24,11 +7,3 @@ while (i < 10000000) {
true == true; true == 1; true == false; true == "str"; true == nil;
"str" == "str"; "str" == "stru"; "str" == 1; "str" == nil; "str" == true;
}

var elapsed = clock() - start;
print "loop";
print loopTime;
print "elapsed";
print elapsed;
print "equals";
print elapsed - loopTime;

0 comments on commit 20032cc

Please sign in to comment.