3 from os.path
import dirname, realpath, join
5 import matplotlib.pyplot
as plt
6 from matplotlib
import rc
9 rc(
'font',**{
'family':
'serif',
'size': 12})
10 rc(
'text', usetex=
True)
12 dir = dirname(realpath(__file__))
14 def compare_simd(name: str, filename_no_simd: str, filename_simd: str):
15 small_no_simd = np.genfromtxt(join(dir, filename_no_simd), delimiter=
',')
16 small_simd = np.genfromtxt(join(dir, filename_simd), delimiter=
',')
18 plt.figure(figsize=(6,6*3/4))
19 plt.plot(small_no_simd[:,0], small_no_simd[:,1],
'-',
20 label=
'Without SIMD intrinsics')
21 plt.plot(small_simd[:,0], small_simd[:,1],
'-',
22 label=
'With SIMD intrinsics')
23 plt.xlim((0, small_simd[-1, 0]*1.025))
24 plt.gca().set_ylim(bottom=0)
26 plt.title(
"Comparison of \\verb|alpha_overlay_stride|\n" +
27 "with and without SIMD intrinsics")
28 plt.xlabel(
'Image size [pixels]')
29 plt.ylabel(
'Time [s]')
32 plt.savefig(name +
'.svg')
36 results = [ np.genfromtxt(join(dir, f), delimiter=
',')
for f
in filenames ]
37 legends = [
'\\verb|' + re.split(
r' |\.', f)[-3] +
'|' for f
in filenames ]
39 plt.figure(figsize=(6,6*3/4))
40 for data, legend
in zip(results, legends):
41 plt.plot(data[:,0], data[:,1],
'-', label=legend)
42 plt.xlim((0, results[0][-1, 0]*1.025))
43 plt.gca().set_ylim(bottom=0)
45 plt.title(
"Comparison of \\verb|alpha_overlay_stride|\n" +
46 "with different scaling methods")
47 plt.xlabel(
'Image size [pixels]')
48 plt.ylabel(
'Time [s]')
51 plt.savefig(name +
'.svg')
54 'Wed Jul 8 15:12:30 2020 no-simd.csv',
55 'Wed Jul 8 15:13:39 2020 simd.csv')
57 'Wed Jul 8 15:45:17 2020 no-simd.csv',
58 'Wed Jul 8 15:50:07 2020 simd.csv')
60 [
'Wed Jul 8 22:47:42 2020 simd div255_round aarch64.csv',
61 'Wed Jul 8 22:49:26 2020 simd div255_round_approx aarch64.csv',
62 'Wed Jul 8 22:51:09 2020 simd div255_floor aarch64.csv',
63 'Wed Jul 8 22:52:49 2020 simd div256_round aarch64.csv',
64 'Wed Jul 8 22:54:28 2020 simd div256_floor aarch64.csv'])