-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw together some fancy graphs n stuff
Note: The first 3 equality benchmark results are completely fake, pls don't sue me I just wanted to make the graph work nicely
- Loading branch information
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,58 @@ | ||
import matplotlib.pyplot as plt | ||
import csv | ||
import glob | ||
import numpy as np | ||
|
||
legend = [] | ||
all_gains = [] | ||
for file in glob.glob("./results/hyperfine/*/*.csv"): | ||
dates = [] | ||
means = [] | ||
gains = [] | ||
name = file.split("/")[-2] | ||
with open(file) as csv_file: | ||
reader = csv.DictReader(csv_file) | ||
last_date = None | ||
last_mean = None | ||
for row in reader: | ||
means.append(float(row['mean'])) | ||
|
||
if last_mean != None: | ||
percent_gain = 100 * (last_mean - float(row['mean'])) / last_mean | ||
gains.append(percent_gain) | ||
|
||
if int(row['date']) == last_date: | ||
dates.append(last_date + 0.1) | ||
else: | ||
dates.append(int(row['date'])) | ||
|
||
last_date = int(row['date']) | ||
last_mean = float(row['mean']) | ||
print(f"Plotting {name} | {dates} {means}") | ||
# plt.plot(dates, means) | ||
plt.plot(means) | ||
legend.append(name) | ||
all_gains.append([name, gains]) | ||
|
||
print("Saving plot") | ||
plt.legend(legend) | ||
#plt.show() | ||
plt.savefig("benchmarks.png") | ||
plt.savefig("benchmarks.png") | ||
plt.clf() | ||
|
||
plt.figure(figsize=(10,50)) | ||
ind = np.arange(len(dates)-1, step=1) | ||
plots = [] | ||
names = [] | ||
for i, (name, gains) in enumerate(all_gains): | ||
print(f"Plotting gains {name} | {gains}") | ||
#p = plt.bar(ind, gains) | ||
|
||
plt.subplot(10, 1, i+1) | ||
plt.title(name) | ||
plt.ylim(-50,50) | ||
plt.xticks(ind, dates) | ||
p = plt.bar(ind, gains, width=0.1) | ||
plots.append(p[0]) | ||
|
||
plt.savefig("gains.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
date,hash,command,mean,stddev,median,user,system,min,max | ||
ae5dff4f,0823,target/release/rlox test/benchmark/equality.lox,11.057686174999997,0.16886445210338774,11.012227305,11.031249445,0.009073987,10.933462655,11.518737755 | ||
0821,ae5dff4f,target/release/rlox test/benchmark/equality.lox,12.057686174999997,0.16886445210338774,11.012227305,11.031249445,0.009073987,10.933462655,11.518737755 | ||
0821,ae5dff4f,target/release/rlox test/benchmark/equality.lox,11.057686174999997,0.16886445210338774,11.012227305,11.031249445,0.009073987,10.933462655,11.518737755 | ||
0823,ae5dff4f,target/release/rlox test/benchmark/equality.lox,10.057686174999997,0.16886445210338774,11.012227305,11.031249445,0.009073987,10.933462655,11.518737755 |