From a3a91aa9f0dcf3c94e546aec1698390c9a0b7638 Mon Sep 17 00:00:00 2001 From: jadep Date: Sun, 12 Nov 2017 21:21:07 -0500 Subject: generate LaTeX tables from some of the benchmarks --- measurements/2017-11-03/table.tex | 405 ++++++++++++++++++++++++++++++++++++++ measurements/tolatex.py | 79 ++++++++ 2 files changed, 484 insertions(+) create mode 100644 measurements/2017-11-03/table.tex create mode 100644 measurements/tolatex.py (limited to 'measurements') diff --git a/measurements/2017-11-03/table.tex b/measurements/2017-11-03/table.tex new file mode 100644 index 000000000..aaa673a6b --- /dev/null +++ b/measurements/2017-11-03/table.tex @@ -0,0 +1,405 @@ + + \begin{figure*} + \begin{tikzpicture} + \begin{axis}[ + height=11cm, + width=\textwidth, + grid=major, + legend pos= north west, + xlabel=Prime Size (bits), + ylabel=Time (seconds)] + \addplot[color=blue,mark=triangle*] coordinates { + (127, 0.12) + (129, 0.19) + (137, 0.20) + (140, 0.20) + (141, 0.20) + (150, 0.20) + (152, 0.19) + (158, 0.20) + (171, 0.28) + (174, 0.28) + (189, 0.28) + (190, 0.29) + (191, 0.28) + (192, 0.27) + (205, 0.36) + (206, 0.37) + (212, 0.38) + (213, 0.37) + (216, 0.38) + (221, 0.38) + (222, 0.37) + (224, 0.32) + }; + \addlegendentry{fiat\_montgomery32} + + \addplot[color=blue,mark=square*] coordinates { + (127, 0.04) + (129, 0.08) + (137, 0.09) + (140, 0.08) + (141, 0.08) + (150, 0.08) + (152, 0.09) + (158, 0.08) + (165, 0.08) + (166, 0.08) + (171, 0.08) + (174, 0.08) + (189, 0.08) + (190, 0.08) + (191, 0.08) + (192, 0.08) + (205, 0.13) + (206, 0.13) + (212, 0.13) + (213, 0.13) + (216, 0.12) + (221, 0.13) + (222, 0.13) + (224, 0.12) + (226, 0.12) + (230, 0.13) + (235, 0.13) + (243, 0.12) + (251, 0.13) + (254, 0.13) + (255, 0.13) + (256, 0.13) + (266, 0.18) + (285, 0.19) + (291, 0.19) + (321, 0.25) + (336, 0.25) + (338, 0.27) + (369, 0.27) + (379, 0.28) + (382, 0.27) + (383, 0.27) + (384, 0.26) + (401, 0.35) + (414, 0.35) + (416, 0.35) + (444, 0.35) + (448, 0.32) + }; + \addlegendentry{fiat\_montgomery64} + + \addplot[color=blue,mark=triangle] coordinates { + (127, 0.05) + (129, 0.06) + (130, 0.03) + (137, 0.11) + (140, 0.06) + (141, 0.06) + (150, 0.06) + (152, 0.06) + (158, 0.06) + (165, 0.11) + (166, 0.16) + (171, 0.12) + (174, 0.12) + (191, 0.15) + (194, 0.09) + (198, 0.11) + (206, 0.19) + (213, 0.28) + (216, 0.08) + (221, 0.13) + (222, 0.13) + (230, 0.13) + (235, 0.10) + (243, 0.10) + (251, 0.13) + (255, 0.13) + (256, 0.18) + (266, 0.19) + (285, 0.27) + (291, 0.18) + (321, 0.30) + (322, 0.21) + (336, 0.23) + (338, 0.20) + (369, 0.29) + (401, 0.30) + (416, 0.25) + }; + \addlegendentry{fiat\_solinas32} + + \addplot[color=blue,mark=square] coordinates { + (127, 0.02) + (129, 0.03) + (130, 0.03) + (137, 0.05) + (140, 0.04) + (141, 0.03) + (150, 0.03) + (152, 0.04) + (158, 0.04) + (165, 0.03) + (166, 0.03) + (171, 0.03) + (174, 0.03) + (189, 0.04) + (190, 0.04) + (191, 0.07) + (192, 0.05) + (194, 0.04) + (196, 0.04) + (198, 0.04) + (206, 0.04) + (212, 0.05) + (213, 0.04) + (216, 0.04) + (221, 0.04) + (222, 0.05) + (226, 0.04) + (230, 0.05) + (235, 0.07) + (243, 0.10) + (251, 0.06) + (255, 0.06) + (256, 0.06) + (266, 0.06) + (285, 0.06) + (291, 0.07) + (321, 0.10) + (336, 0.10) + (338, 0.10) + (369, 0.15) + (379, 0.13) + (382, 0.23) + (384, 0.15) + (401, 0.15) + (414, 0.20) + (416, 0.12) + (444, 0.16) + (448, 0.12) + (450, 0.12) + (452, 0.16) + (468, 0.17) + (480, 0.15) + (488, 0.55) + (489, 0.20) + (495, 0.19) + (511, 0.24) + (512, 0.24) + (521, 0.25) + }; + \addlegendentry{fiat\_solinas64} + + \addplot[color=red,mark=ball*] coordinates { + (127, 0.15) + (129, 0.27) + (130, 0.27) + (137, 0.27) + (140, 0.27) + (141, 0.27) + (150, 0.27) + (152, 0.27) + (158, 0.27) + (165, 0.27) + (166, 0.27) + (171, 0.27) + (174, 0.27) + (189, 0.28) + (190, 0.27) + (191, 0.26) + (192, 0.24) + (194, 0.35) + (196, 0.34) + (198, 0.34) + (205, 0.34) + (206, 0.34) + (212, 0.35) + (213, 0.35) + (216, 0.35) + (221, 0.35) + (222, 0.34) + (224, 0.35) + (226, 0.34) + (230, 0.34) + (235, 0.34) + (243, 0.34) + (251, 0.35) + (254, 0.35) + (255, 0.33) + (256, 0.34) + (266, 0.43) + (285, 0.43) + (291, 0.43) + (321, 0.52) + (322, 0.52) + (336, 0.53) + (338, 0.53) + (369, 0.53) + (379, 0.53) + (382, 0.53) + (383, 0.50) + (384, 0.47) + (389, 0.59) + (401, 0.60) + (413, 0.61) + (414, 0.60) + (416, 0.60) + (444, 0.60) + (448, 0.53) + (450, 0.69) + (452, 0.68) + (468, 0.69) + (480, 0.69) + (488, 0.69) + (489, 0.69) + (495, 0.69) + (510, 0.69) + (511, 0.65) + (512, 0.63) + (521, 0.81) + }; + \addlegendentry{gmpvar} + + \addplot[color=red,mark=o] coordinates { + (127, 0.61) + (129, 0.79) + (130, 0.78) + (137, 0.81) + (140, 0.81) + (141, 0.81) + (150, 0.80) + (152, 0.80) + (158, 0.76) + (165, 0.79) + (166, 0.78) + (171, 0.79) + (174, 0.78) + (189, 0.79) + (190, 0.78) + (191, 0.77) + (192, 0.71) + (194, 0.93) + (196, 0.87) + (198, 0.86) + (205, 0.84) + (206, 0.86) + (212, 0.88) + (213, 0.88) + (216, 0.86) + (221, 0.88) + (222, 0.88) + (224, 0.86) + (226, 0.90) + (230, 0.88) + (235, 0.88) + (243, 0.89) + (251, 0.90) + (254, 0.90) + (255, 0.87) + (256, 0.85) + (266, 0.98) + (285, 0.97) + (291, 0.99) + (321, 1.16) + (322, 1.13) + (336, 1.07) + (338, 1.06) + (369, 1.06) + (379, 1.07) + (382, 1.08) + (383, 1.04) + (384, 0.97) + (389, 1.18) + (401, 1.16) + (413, 1.17) + (414, 1.16) + (416, 1.17) + (444, 1.17) + (448, 1.05) + (450, 1.34) + (452, 1.29) + (468, 1.26) + (480, 1.27) + (488, 1.27) + (489, 1.27) + (495, 1.29) + (510, 1.26) + (511, 1.22) + (512, 1.15) + (521, 1.39) + }; + \addlegendentry{gmpxx} + + \addplot[color=red,mark=*] coordinates { + (127, 0.27) + (129, 0.38) + (130, 0.38) + (137, 0.38) + (140, 0.38) + (141, 0.38) + (150, 0.38) + (152, 0.38) + (158, 0.38) + (165, 0.38) + (166, 0.38) + (171, 0.38) + (174, 0.38) + (189, 0.38) + (190, 0.38) + (191, 0.36) + (192, 0.28) + (194, 0.50) + (196, 0.50) + (198, 0.50) + (205, 0.49) + (206, 0.50) + (212, 0.50) + (213, 0.50) + (216, 0.50) + (221, 0.50) + (222, 0.50) + (224, 0.50) + (226, 0.50) + (230, 0.49) + (235, 0.50) + (243, 0.50) + (251, 0.50) + (254, 0.50) + (255, 0.48) + (256, 0.38) + (266, 0.64) + (285, 0.65) + (291, 0.64) + (321, 0.80) + (322, 0.81) + (336, 0.80) + (338, 0.79) + (369, 0.79) + (379, 0.80) + (382, 0.81) + (383, 0.75) + (384, 0.63) + (389, 0.96) + (401, 0.97) + (413, 0.97) + (414, 0.96) + (416, 0.96) + (444, 0.96) + (448, 0.77) + (450, 1.17) + (452, 1.17) + (468, 1.17) + (480, 1.17) + (488, 1.16) + (489, 1.17) + (495, 1.16) + (510, 1.17) + (511, 1.11) + (512, 0.95) + (521, 1.41) + }; + \addlegendentry{gmpsec} + + + \end{axis} + \end{figure*} + diff --git a/measurements/tolatex.py b/measurements/tolatex.py new file mode 100644 index 000000000..73ec7fa3a --- /dev/null +++ b/measurements/tolatex.py @@ -0,0 +1,79 @@ +# Generates benchmark graphs in LaTex (following format from the pgfplots +# package) +# +# This ignores duplicate entries, including different primes with the same +# number of bits. +import sys + +USAGE = "USAGE: python tolatex.py [input file]" + +SETUPS = { + "fiat_montgomery32": "color=blue,mark=triangle*", + "fiat_montgomery64": "color=blue,mark=square*", + "fiat_solinas32": "color=blue,mark=triangle", + "fiat_solinas64": "color=blue,mark=square", + "gmpvar": "color=red,mark=ball*", + "gmpxx": "color=red,mark=o", + "gmpsec" : "color=red,mark=*" + } + +class ParseException(Exception): pass + +def parse_line(line): + data = line.strip().split("\t") + if len(data) != 3 or (data[1] not in SETUPS) or ("2e" not in data[0]) : + raise ParseException("Could not parse line %s" %line) + return { + "prime" : data[0], + "setup" : data[1], + "time" : data[2] } + +# remove duplicates, reorganize, and parse number of bits from primes +def clean_data(parsed_lines): + out = {s:{} for s in SETUPS} + for ln in parsed_lines: + nbits = ln["prime"].split("2e")[1].split("m")[0].split("p")[0] + # if some measurement is duplicated, ignore the repeats + if nbits not in out[ln["setup"]]: + out[ln["setup"]][nbits] = ln["time"] + return out + +def makeplot(data): + out = """ + \\begin{figure*} + \\begin{tikzpicture} + \t\\begin{axis}[ + \t\theight=11cm, + \t\twidth=\\textwidth, + \t\tgrid=major, + \t\tlegend pos= north west, + \t\txlabel=Prime Size (bits), + \t\tylabel=Time (seconds)] + """ + for s in SETUPS: + out +="\t\t\\addplot[%s] coordinates {\n" %SETUPS[s] + for nbits in data[s]: + out += "\t\t\t(%s, %s) \n" %(nbits, data[s][nbits]) + out += "\t\t};\n" + out += "\t\t\\addlegendentry{%s}\n\n" %s.replace("_", "\_") + out += """ + \t\end{axis} + \\end{tikzpicture} + \\end{figure*} + """ + return out + +if __name__ == "__main__": + if len(sys.argv) != 2: + print(USAGE) + sys.exit() + f = open(sys.argv[1]) + parsed_lines = [] + for line in f: + try: + parsed_lines.append(parse_line(line)) + except ParseException: + print("WARNING: Could not parse line %s, skipping" %line) + f.close() + print(makeplot(clean_data(parsed_lines))) + -- cgit v1.2.3