Skip to content

Commit

Permalink
Merge pull request #32 from sebbekarlsson/array-access-bugfix
Browse files Browse the repository at this point in the history
Array access bugfix
  • Loading branch information
sebbekarlsson authored Feb 14, 2021
2 parents fda3097 + 6a6c0b7 commit c99863e
Show file tree
Hide file tree
Showing 19 changed files with 1,644 additions and 241 deletions.
100 changes: 50 additions & 50 deletions bench.json

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions benchmark/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import matplotlib.pyplot as plt
import base64
from argparse import ArgumentParser
from functools import reduce

parser = ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -188,7 +189,51 @@ def generate_graph(mark):
return filename


def generate_overview_graph(marks):
plt.figure()

data = {}

for mark in marks:
for r in mark['runs']:
if r['title'] not in data:
data[r['title']] = []
data[r['title']].append(r)

graph_data = dict(zip(data.keys(), [{} for x in data.keys()]))

for k, v in data.items():
times = list(map(lambda x: x['time'], v))
average_time = reduce(lambda a, b: a + b, times) / len(times)
graph_data[k]['average_time'] = average_time

sizes = list(map(lambda x: x['size'], v))
average_size = reduce(lambda a, b: a + b, sizes) / len(sizes)
graph_data[k]['average_size'] = average_size

x = data.keys()
y = [graph_data[k]['average_time'].microseconds for k in x]
y2 = [graph_data[k]['average_size'] for k in x]

C = 48 / 255
colors = [(C, C, C) for k in x]

plt.subplot(1, 2, 1)
plt.bar(x, y, label="Average time (microseconds)", color=colors)
plt.legend()
plt.subplot(1, 2, 2)
plt.bar(x, y2, label="Average output size (bytes)", color=colors)
plt.legend()

plt.tight_layout()
plt.savefig(
'{}/{}'.format(GRAPH_DIR, "overview.svg"), dpi=99, transparent=True)

print(graph_data)


def generate_graphs(marks):
generate_overview_graph(marks)
return list(map(generate_graph, marks))


Expand Down
Loading

0 comments on commit c99863e

Please sign in to comment.