diff --git a/images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png b/images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png index b743ca7..133f948 100644 Binary files a/images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png and b/images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png differ diff --git a/images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png b/images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png index 155d233..ca18b3c 100644 Binary files a/images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png and b/images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png differ diff --git a/images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png b/images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png index 11650fd..0b7177b 100644 Binary files a/images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png and b/images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png differ diff --git a/images/evm-vs-wasm-blake2b-huff-rust.png b/images/evm-vs-wasm-blake2b-huff-rust.png index 965309d..74261d8 100644 Binary files a/images/evm-vs-wasm-blake2b-huff-rust.png and b/images/evm-vs-wasm-blake2b-huff-rust.png differ diff --git a/images/evm-vs-wasm-blake2b-sol-huff.png b/images/evm-vs-wasm-blake2b-sol-huff.png index 0db010f..ffb32a4 100644 Binary files a/images/evm-vs-wasm-blake2b-sol-huff.png and b/images/evm-vs-wasm-blake2b-sol-huff.png differ diff --git a/images/evm-vs-wasm-blake2b-sol-rust.png b/images/evm-vs-wasm-blake2b-sol-rust.png index 6df55b7..dd58233 100644 Binary files a/images/evm-vs-wasm-blake2b-sol-rust.png and b/images/evm-vs-wasm-blake2b-sol-rust.png differ diff --git a/images/evm-vs-wasm-mul256-sol-rust.png b/images/evm-vs-wasm-mul256-sol-rust.png index b167369..dfe5c8e 100644 Binary files a/images/evm-vs-wasm-mul256-sol-rust.png and b/images/evm-vs-wasm-mul256-sol-rust.png differ diff --git a/images/evm384-bls12-pairings-synth-loop-rust-wasm.png b/images/evm384-bls12-pairings-synth-loop-rust-wasm.png index a4c077c..c9f9b90 100644 Binary files a/images/evm384-bls12-pairings-synth-loop-rust-wasm.png and b/images/evm384-bls12-pairings-synth-loop-rust-wasm.png differ diff --git a/images/evm384-bls12-synth-loop-vs-native-rust.png b/images/evm384-bls12-synth-loop-vs-native-rust.png index 941a0fc..b82d37a 100644 Binary files a/images/evm384-bls12-synth-loop-vs-native-rust.png and b/images/evm384-bls12-synth-loop-vs-native-rust.png differ diff --git a/images/evm384-bls12-synth-loop-vs-pairings.png b/images/evm384-bls12-synth-loop-vs-pairings.png index f70cbd8..5a0cdf3 100644 Binary files a/images/evm384-bls12-synth-loop-vs-pairings.png and b/images/evm384-bls12-synth-loop-vs-pairings.png differ diff --git a/images/evm384-bls12-synth-loop-wasm.png b/images/evm384-bls12-synth-loop-wasm.png index e5bfd81..44062cf 100644 Binary files a/images/evm384-bls12-synth-loop-wasm.png and b/images/evm384-bls12-synth-loop-wasm.png differ diff --git a/images/evm384-wasm-native-pairings-and-synth-loop.png b/images/evm384-wasm-native-pairings-and-synth-loop.png index 9834b0d..668cd68 100644 Binary files a/images/evm384-wasm-native-pairings-and-synth-loop.png and b/images/evm384-wasm-native-pairings-and-synth-loop.png differ diff --git a/images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png b/images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png index 0bf1604..02029b3 100644 Binary files a/images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png and b/images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png differ diff --git a/images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png b/images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png index df1e21e..b116ea9 100644 Binary files a/images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png and b/images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png differ diff --git a/notebooks/wasm-engines.ipynb b/notebooks/wasm-engines.ipynb index 5e4c72f..e8f675e 100644 --- a/notebooks/wasm-engines.ipynb +++ b/notebooks/wasm-engines.ipynb @@ -622,7 +622,7 @@ "outputs": [], "source": [ "# non-stacked bar chart, for only plotting exec time or total time\n", - "def plotOneTestUsingTimeCol(df_data, time_col_name=\"time\", suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium'):\n", + "def plotOneTestUsingTimeCol(df_data, filepath, time_col_name=\"time\", suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium'):\n", " plt.style.use('ggplot')\n", " plt.figure()\n", " df_total_times = df_data.copy()\n", @@ -633,7 +633,8 @@ " ax.xaxis.set_tick_params(labelrotation=60, labelsize=12)\n", " adjust_text_labels(labelBarHeights(ax))\n", " plt.suptitle(suptitle, fontsize=18, y=suptitle_pos)\n", - " return plt" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -650,7 +651,7 @@ "outputs": [], "source": [ "# non-stacked bar chart, for only plotting exec time or total time\n", - "def plotOneTest(df_data, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium'):\n", + "def plotOneTest(df_data, filepath, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium'):\n", " plt.style.use('ggplot')\n", " plt.figure()\n", " df_total_times = df_data[['exec_time', 'parse_time']].copy()\n", @@ -663,7 +664,8 @@ " ax.xaxis.set_tick_params(labelrotation=60, labelsize=12)\n", " adjust_text_labels(labelBarHeights(ax))\n", " plt.suptitle(suptitle, fontsize=18, y=suptitle_pos)\n", - " return plt\n" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -673,7 +675,7 @@ "outputs": [], "source": [ "# non-stacked bar chart, for only plotting exec time or total time\n", - "def plotOneTestColoredTicksBLS(df_data, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium', highlight_ticks=None):\n", + "def plotOneTestColoredTicksBLS(df_data, filepath, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium', highlight_ticks=None):\n", " #f = plt.figure(figsize=[14, 8])\n", " #plt.figure(figsize=[14, 8])\n", " plt.style.use('ggplot')\n", @@ -698,8 +700,8 @@ " #[i.set_color('tab:green') for i in plt.gca().get_xticklabels() if i.get_text() == highlight_tick]\n", " adjust_text_labels(labelBarHeights(ax))\n", " plt.suptitle(suptitle, fontsize=18, y=suptitle_pos)\n", - " return plt\n", - "\n" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -709,7 +711,7 @@ "outputs": [], "source": [ "# non-stacked bar chart, for only plotting exec time or total time\n", - "def plotOneTestColoredTicks(df_data, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium', highlight_ticks=None):\n", + "def plotOneTestColoredTicks(df_data, filepath, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium', highlight_ticks=None):\n", " #f = plt.figure(figsize=[14, 8])\n", " #plt.figure(figsize=[14, 8])\n", " plt.style.use('ggplot')\n", @@ -734,8 +736,8 @@ " #[i.set_color('tab:green') for i in plt.gca().get_xticklabels() if i.get_text() == highlight_tick]\n", " adjust_text_labels(labelBarHeights(ax))\n", " plt.suptitle(suptitle, fontsize=18, y=suptitle_pos)\n", - " return plt\n", - "\n" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -744,7 +746,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotOneTestGrouped(df_1, test_title=\"test_title\", title=\"plot Title\", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None):\n", + "def plotOneTestGrouped(df_1, filepath, test_title=\"test_title\", title=\"plot Title\", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None):\n", " # to group by engine, pivot to `columns='engine'`\n", " #df_1 = pd.pivot_table(df_1, values='exec_time', columns=['engine'], index=['bench_name'], aggfunc=np.mean)\n", " # group by bench name\n", @@ -764,7 +766,8 @@ " adjust_text_labels(labelBarHeights(ax))\n", "\n", " plt.suptitle(title, fontsize=16, y=0.98)\n", - " return plt\n" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -773,7 +776,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotOneTestGroupedExexTime(df_1, test_title=\"test_title\", title=\"plot Title\", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None):\n", + "def plotOneTestGroupedExexTime(df_1, filepath, test_title=\"test_title\", title=\"plot Title\", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None):\n", " # to group by engine, pivot to `columns='engine'`\n", " #df_1 = pd.pivot_table(df_1, values='exec_time', columns=['engine'], index=['bench_name'], aggfunc=np.mean)\n", " # group by bench name\n", @@ -793,7 +796,8 @@ " adjust_text_labels(labelBarHeights(ax))\n", "\n", " plt.suptitle(title, fontsize=16, y=0.98)\n", - " return plt" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -809,7 +813,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotScoutStackedTest(df_data, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium'):\n", + "def plotScoutStackedTest(df_data, filepath, suptitle=\"title\", suptitle_pos=1.00, subtitle=\"subchart\", subtitle_size='medium'):\n", " #plt.figure(figsize=[12,7])\n", " plt.figure()\n", " # for some reason, exec_time needs to come first for the stacked chart to display correctly\n", @@ -823,8 +827,9 @@ " adjust_text_labels(labelBarHeights(ax, lower_y_bound=False))\n", " ax.legend(labels=[\"execution time\", \"startup time\"])\n", " plt.suptitle(suptitle, fontsize=18, y=suptitle_pos)\n", - " #ax.autoscale(enable=True) \n", - " return plt\n" + " #ax.autoscale(enable=True)\n", + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -875,13 +880,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTest(df_scout_means_biturbo_token,\n", + "plotOneTest(df_scout_means_biturbo_token,\n", + " '../images/scout-biturbo-token-all-engines.png',\n", " suptitle=\"\\nbiturbo token - all scout engines\",\n", " suptitle_pos=1.05,\n", " subtitle=\"biturbo-token-eth1-mainnet-stateless-block-hexary-trie-keccak256-multiproof\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-biturbo-token-all-engines.png', bbox_inches='tight')\n" + " subtitle_size='xx-large')\n" ] }, { @@ -904,14 +908,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_fast_biturbo_means,\n", + "plotScoutStackedTest(df_scout_fast_biturbo_means,\n", + " '../images/scout-biturbo-token-compilers-vs-interpreters.png',\n", " suptitle=\"\\nbiturbo token - fast scout engines - wasm compilers vs interpreters (v8 vs wabt)\",\n", " suptitle_pos=1.03,\n", " subtitle=\"biturbo-token-eth1-mainnet-stateless-block-hexary-trie-keccak256-multiproof\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-biturbo-token-compilers-vs-interpreters.png', bbox_inches='tight')\n", - "\n" + " subtitle_size='xx-large')\n" ] }, { @@ -969,14 +971,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTest(df_scout_means_ecrecover_websnark_secp256k1,\n", + "plotOneTest(df_scout_means_ecrecover_websnark_secp256k1,\n", + " '../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-all-engines.png',\n", " suptitle=\"websnark-secp256k1-sig-verify - all Scout engines\",\n", " suptitle_pos=1.0,\n", " subtitle=\"ecrecover-eth1-txns-websnark-secp256k1-verify-72-sigs\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "\n", - "fig_plt.savefig('../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-all-engines.png', bbox_inches='tight')\n" + " subtitle_size='xx-large')\n" ] }, { @@ -999,14 +999,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_fast_ecrecover_means,\n", + "plotScoutStackedTest(df_scout_fast_ecrecover_means,\n", + " '../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-wabt-vs-v8.png',\n", " #suptitle=\"websnark-secp256k1-sig-verify - fast Scout engines - compilers (v8) vs interpreters (wabt)\",\n", " suptitle=\"compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \\n vs. \\n interpreter engine (wabt) with bignum host funcs\",\n", " suptitle_pos=1.07,\n", " subtitle=\"ecrecover-eth1-txns-websnark-secp256k1-verify-72-sigs\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-wabt-vs-v8.png', bbox_inches='tight')\n" + " subtitle_size='xx-large')\n" ] }, { @@ -1087,13 +1086,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTest(df_scout_means_ecpairing_zkrollup,\n", + "plotOneTest(df_scout_means_ecpairing_zkrollup,\n", + " '../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-all-engines.png',\n", " suptitle=\"websnark-bn128-pairings - all Scout engines\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-all-engines.png', bbox_inches='tight')\n" + " subtitle_size='xx-large')\n" ] }, { @@ -1102,12 +1100,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_fast_means_ecpairing_zkrollup,\n", + "plotScoutStackedTest(df_scout_fast_means_ecpairing_zkrollup,\n", + " '../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-v8.png',\n", " suptitle=\"compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \\n vs. \\n interpreter engine (wabt) with bignum host funcs\",\n", " suptitle_pos=1.07,\n", " subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", - " subtitle_size='xx-large')\n", - "fig_plt.savefig('../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-v8.png', bbox_inches='tight')" + " subtitle_size='xx-large')\n" ] }, { @@ -1153,13 +1151,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTest(df_scout_means_rolluprs,\n", + "plotOneTest(df_scout_means_rolluprs,\n", + " '../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-all-engines.png',\n", " suptitle=\"rollup.rs-bn128-pairings - all Scout engines\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-all-engines.png', bbox_inches='tight')" + " subtitle_size='xx-large')\n" ] }, { @@ -1256,12 +1253,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_fast_means_rolluprs,\n", + "plotScoutStackedTest(df_scout_fast_means_rolluprs,\n", + " '../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-v8.png',\n", " suptitle=\"compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \\n vs. \\n interpreter engine (wabt) with bignum host funcs\",\n", " suptitle_pos=1.07,\n", " subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", - " subtitle_size='xx-large')\n", - "fig_plt.savefig('../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-v8.png', bbox_inches='tight')" + " subtitle_size='xx-large')" ] }, { @@ -1400,7 +1397,8 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestGrouped(df_scout_rust_vs_websnark,\n", + "plotOneTestGrouped(df_scout_rust_vs_websnark,\n", + " '../images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png',\n", " title=\"websnark vs rust - zkrollup bn128 pairings (websnark/bn128 vs rollup.rs)\",\n", " test_title=\"\",\n", " group_order=['websnark-wasm', 'rust-wasm'],\n", @@ -1413,9 +1411,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "fig_plt.savefig('../images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png', bbox_inches='tight')" - ] + "source": [] }, { "cell_type": "code", @@ -1467,14 +1463,13 @@ "outputs": [], "source": [ "\n", - "fig_plt = plotOneTestGrouped(df_scout_rust_vs_websnark_fast_vs_native,\n", + "plotOneTestGrouped(df_scout_rust_vs_websnark_fast_vs_native,\n", + " '../images/websnark-vs-rust-wasm-native-zkrollup-bn128-pairings',\n", " title=\"websnark vs rust - zkrollup bn128 pairings (websnark/bn128 vs rollup.rs)\",\n", " test_title=\"\",\n", " sort_by=[\"rust-native\", \"rust-wasm\", \"websnark-wasm\"],\n", " colors=['tab:green', 'tab:blue', 'tab:orange'],\n", - " group_order=[\"rust-native\", \"websnark-wasm\", \"rust-wasm\"])\n", - "\n", - "fig_plt.savefig('../images/websnark-vs-rust-wasm-native-zkrollup-bn128-pairings', bbox_inches='tight')" + " group_order=[\"rust-native\", \"websnark-wasm\", \"rust-wasm\"])" ] }, { @@ -1601,13 +1596,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_websnark_vs_native_means,\n", + "plotScoutStackedTest(df_websnark_vs_native_means,\n", + " '../images/websnark-vs-native-bn128-two-pairings-v8.png',\n", " suptitle=\"compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \\n vs. \\n interpreter engine (wabt) with bignum host funcs\",\n", " suptitle_pos=1.07,\n", " subtitle=\"bn128-two-pairings - websnark vs rust-native\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/websnark-vs-native-bn128-two-pairings-v8.png', bbox_inches='tight')" + " subtitle_size='xx-large')\n" ] }, { @@ -1678,7 +1672,9 @@ "source": [ "f = plt.figure(figsize=(14,8))\n", "\n", - "ax = sns.barplot(x='engine', y='time', data=df_websnark_vs_native)" + "ax = sns.barplot(x='engine', y='time', data=df_websnark_vs_native)\n", + "\n", + "plt.close('all')" ] }, { @@ -1703,7 +1699,9 @@ "source": [ "f = plt.figure(figsize=(14,8))\n", "\n", - "ax = sns.barplot(x='engine', y='exec_time', hue='bench_name', data=df_scout_rust_vs_websnark)" + "ax = sns.barplot(x='engine', y='exec_time', hue='bench_name', data=df_scout_rust_vs_websnark)\n", + "\n", + "plt.close('all')" ] }, { @@ -1776,12 +1774,11 @@ "outputs": [], "source": [ "plotOneTest(df_scout_means_daiquiri_zkmixer,\n", + " '../images/scout-daiquiri-all-engines.png',\n", " suptitle=\"daiquiri-zkmixer - all Scout engines\",\n", " suptitle_pos=1.02,\n", " subtitle=\"daiquiri-zkmixer-websnark-bn128-groth16-four-pairings-and-mimc\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-daiquiri-all-engines.png', bbox_inches='tight')" + " subtitle_size='xx-large')" ] }, { @@ -1790,13 +1787,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_fast_means_daiquiri_zkmixer,\n", + "plotScoutStackedTest(df_scout_fast_means_daiquiri_zkmixer,\n", + " '../images/scout-daiquiri-v8-vs-wabt.png',\n", " suptitle=\"wasm compilers - optimizing (v8-turbofan) and single-pass (v8-liftoff) \\n vs. \\n wasm interpreter (wabt) with bignum host funcs\",\n", " suptitle_pos=1.07,\n", " subtitle=\"daiquiri-zkmixer-websnark-bn128-groth16-four-pairings-and-mimc\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/scout-daiquiri-v8-vs-wabt.png', bbox_inches='tight')" + " subtitle_size='xx-large')" ] }, { @@ -2221,7 +2217,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotInterpThreeTests(df_testdata, three_names, title=\"Title\", filter_engines=None):\n", + "def plotInterpThreeTests(df_testdata, three_names, filepath, title=\"Title\", filter_engines=None):\n", " if filter_engines is not None:\n", " df_testdata = filterDfEngines(df_testdata.reset_index(), filter_engines)\n", " df_testdata.set_index('engine', inplace=True)\n", @@ -2256,7 +2252,8 @@ " ax1[0].set(ylabel='milliseconds')\n", " \n", " f.suptitle(title, fontsize=16, y=0.98)\n", - " return plt" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -2272,8 +2269,7 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotInterpThreeTests(df_interp, blake2b_test_names, title=\"wasm interpreters compared - blake2b\")\n", - "plt_fig.savefig('../images/wasm-interp-blake2b.png', bbox_inches='tight')" + "plotInterpThreeTests(df_interp, blake2b_test_names, '../images/wasm-interp-blake2b.png', title=\"wasm interpreters compared - blake2b\")" ] }, { @@ -2317,7 +2313,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotThreeTestsExecTime(df_testdata, three_names, title=\"Title\", filter_engines=None):\n", + "def plotThreeTestsExecTime(df_testdata, three_names, filepath, title=\"Title\", filter_engines=None):\n", " if filter_engines is not None:\n", " df_testdata = filterDfEngines(df_testdata.reset_index(), filter_engines)\n", " df_testdata.set_index('engine', inplace=True)\n", @@ -2352,7 +2348,8 @@ " ax1[0].set(ylabel='milliseconds')\n", " \n", " f.suptitle(title, fontsize=16, y=0.98)\n", - " return f\n" + " f.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -2361,8 +2358,7 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotThreeTestsExecTime(df_interp, blake2b_test_names, title=\"wasm interpreters compared - blake2b\")\n", - "plt_fig.savefig('../images/wasm-interp-blake2b-exec.png', bbox_inches='tight')" + "plotThreeTestsExecTime(df_interp, blake2b_test_names, '../images/wasm-interp-blake2b-exec.png', title=\"wasm interpreters compared - blake2b\")" ] }, { @@ -2399,11 +2395,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotInterpThreeTests(df_interp,\n", + "plotInterpThreeTests(df_interp,\n", " blake2b_test_names,\n", + " '../images/wasm-interp-blake2b-fast.png',\n", " title=\"wasm interpreters compared - blake2b\",\n", - " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])\n", - "plt_fig.savefig('../images/wasm-interp-blake2b-fast.png', bbox_inches='tight')" + " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])" ] }, { @@ -2412,11 +2408,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotInterpThreeTests(df_interp,\n", + "plotInterpThreeTests(df_interp,\n", " modexp_test_names,\n", + " '../images/wasm-interp-modexp.png',\n", " title=\"wasm interpreters compared - modexp\",\n", - " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])\n", - "plt_fig.savefig('../images/wasm-interp-modexp.png', bbox_inches='tight')" + " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])" ] }, { @@ -2425,11 +2421,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotInterpThreeTests(df_interp,\n", + "plotInterpThreeTests(df_interp,\n", " bn128_add_test_names,\n", + " '../images/wasm-interp-bn128-add.png',\n", " title=\"wasm interpreters compared - bn128_add\",\n", - " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])\n", - "plt_fig.savefig('../images/wasm-interp-bn128-add.png', bbox_inches='tight')" + " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])" ] }, { @@ -2445,11 +2441,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotThreeTestsExecTime(df_interp,\n", + "plotThreeTestsExecTime(df_interp,\n", " blake2b_test_names,\n", + " '../images/wasm-interp-blake2b-life-wagon-v8.png',\n", " title=\"wasm interpreters compared - blake2b\",\n", - " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])\n", - "plt_fig.savefig('../images/wasm-interp-blake2b-life-wagon-v8.png', bbox_inches='tight')" + " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])" ] }, { @@ -2458,11 +2454,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotThreeTestsExecTime(df_interp,\n", + "plotThreeTestsExecTime(df_interp,\n", " bls12_test_names,\n", + " '../images/wasm-interp-bls12.png',\n", " title=\"wasm interpreters compared - bls12\",\n", - " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])\n", - "plt_fig.savefig('../images/wasm-interp-bls12.png', bbox_inches='tight')" + " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])" ] }, { @@ -2575,7 +2571,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotJitBomb(df_jit, title=\"jit bomb chart\", log_scale=False):\n", + "def plotJitBomb(df_jit, filepath, title=\"jit bomb chart\", log_scale=False):\n", " f = plt.figure(figsize=(14,8))\n", "\n", " bombplot = sns.barplot(x='engine', y='value', hue='exec_or_compile', dodge=True, data=df_jit)\n", @@ -2593,7 +2589,8 @@ " textcoords = 'offset points')\n", "\n", " f.suptitle(title, fontsize=18, y=0.95)\n", - " return f" + " f.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -2645,8 +2642,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotJitBomb(df_jitbomb_1, \"JIT bomb guido-fuzzer-find-1\")\n", - "fig_plt.savefig('../images/standalone-jitbomb-guido-fuzzer-find-1.png', bbox_inches='tight')" + "plotJitBomb(df_jitbomb_1,\n", + " '../images/standalone-jitbomb-guido-fuzzer-find-1.png',\n", + " \"JIT bomb guido-fuzzer-find-1\")" ] }, { @@ -2655,8 +2653,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotJitBomb(df_jitbomb_1, \"JIT bomb guido-fuzzer-find-1 - log scale\", log_scale=True)\n", - "fig_plt.savefig('../images/standalone-jitbomb-guido-fuzzer-find-1-log-scale.png', bbox_inches='tight')" + "plotJitBomb(df_jitbomb_1,\n", + " '../images/standalone-jitbomb-guido-fuzzer-find-1-log-scale.png',\n", + " \"JIT bomb guido-fuzzer-find-1 - log scale\", log_scale=True)" ] }, { @@ -2708,9 +2707,7 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotJitBomb(df_jitbomb_2, \"JIT bomb guido-fuzzer-find-2 (log scale)\", log_scale=True)\n", - "\n", - "fig_plt.savefig('../images/standalone-jitbomb-guido-fuzzer-find-2-log-scale.png', bbox_inches='tight')" + "plotJitBomb(df_jitbomb_2, '../images/standalone-jitbomb-guido-fuzzer-find-2-log-scale.png', \"JIT bomb guido-fuzzer-find-2 (log scale)\", log_scale=True)" ] }, { @@ -2778,7 +2775,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotCompilerStackedOneTest(df_benchdata, test_name):\n", + "def plotCompilerStackedOneTest(df_benchdata, filepath, test_name):\n", " plt.figure()\n", " df_1 = df_benchdata[df_benchdata['test_name'] == test_name]\n", " # for some reason, exec_time needs to come first for the stacked chart to display correctly\n", @@ -2794,7 +2791,8 @@ " plt.ylabel(\"seconds (log scale)\")\n", " adjust_text_labels(labelBarHeights(ax, lower_y_bound=False))\n", " ax.legend(labels=[\"execution time\", \"compile time\"])\n", - " return plt\n" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -2803,8 +2801,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotCompilerStackedOneTest(df_compiler, \"blake2b-8415-bytes\")\n", - "fig_plt.savefig('../images/standalone-blake2b-8415-bytes-compilers.png', bbox_inches='tight')" + "plotCompilerStackedOneTest(df_compiler,\n", + " '../images/standalone-blake2b-8415-bytes-compilers.png',\n", + " \"blake2b-8415-bytes\")" ] }, { @@ -2897,8 +2896,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotCompilerStackedOneTest(df_native_and_compile, \"bls12-381-aggreg-128-pubkeys-verify-sig\")\n", - "fig_plt.savefig('../images/standalone-bls12-381-aggreg-128-pubkeys-verify-sig-compilers-vs-native.png', bbox_inches='tight')" + "plotCompilerStackedOneTest(df_native_and_compile,\n", + " '../images/standalone-bls12-381-aggreg-128-pubkeys-verify-sig-compilers-vs-native.png',\n", + " \"bls12-381-aggreg-128-pubkeys-verify-sig\")" ] }, { @@ -3009,7 +3009,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotCompilerSpeedup(df_compiler_speedup, interp_name=\"interp\", compiler_name=\"compiler\"):\n", + "def plotCompilerSpeedup(df_compiler_speedup, filepath, interp_name=\"interp\", compiler_name=\"compiler\"):\n", " df_is = df_compiler_speedup.copy()\n", " plot_tests = df_is['test_name'].tolist()\n", " test_index = all_tests.copy()\n", @@ -3038,7 +3038,8 @@ " plt.legend(labels=[\"compiler engine is faster (ratio > 1x)\", \"compiler speedup \\n (ratio: interp_exec_time/compiler_exec_time)\"])\n", "\n", " #f.suptitle(title, fontsize=16, y=0.95)\n", - " return plt\n" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -3047,8 +3048,9 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotCompilerSpeedup(df_wabt_v8liftoff, interp_name=\"wabt\", compiler_name=\"v8-liftoff\")\n", - "plt_fig.savefig('../images/standalone-wabt-vs-v8-liftoff-speedup.png', bbox_inches='tight')" + "plotCompilerSpeedup(df_wabt_v8liftoff,\n", + " '../images/standalone-wabt-vs-v8-liftoff-speedup.png',\n", + " interp_name=\"wabt\", compiler_name=\"v8-liftoff\")" ] }, { @@ -3078,7 +3080,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotInterpOneEngine(df_benchdata, engine, test_names, title=\"\"):\n", + "def plotInterpOneEngine(df_benchdata, filepath, engine, test_names, title=\"\"):\n", " df_bench = df_benchdata.loc[engine][df_benchdata.loc[engine]['test_name'].isin(test_names)]\n", " df_bench.set_index('test_name', inplace=True)\n", " df_bench = df_bench.reindex(test_names)\n", @@ -3091,7 +3093,8 @@ " plt.legend([handles[1], handles[0]], ['execution time (top bar/label)', 'startup time (bottom bar/label - bar not visible for times < 20.0ms)'])\n", " adjust_text_labels(labelBarHeights(ax))\n", " plt.suptitle(title, fontsize=16, y=0.95)\n", - " return plt" + " plt.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')" ] }, { @@ -3100,8 +3103,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotInterpOneEngine(df_interp, 'wasmi', all_tests, \"Wasmi - all Precompiles (existing and proposed) compared\")\n", - "plt_fig.savefig('../images/standalone-wasmi-all-precompiles.png', bbox_inches='tight')" + "plotInterpOneEngine(df_interp,\n", + " '../images/standalone-wasmi-all-precompiles.png',\n", + " 'wasmi',\n", + " all_tests,\n", + " \"Wasmi - all Precompiles (existing and proposed) compared\")" ] }, { @@ -3117,8 +3123,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotInterpOneEngine(df_interp, 'wabt', all_tests, \"Wabt - all Precompiles (existing and proposed) compared\")\n", - "plt_fig.savefig('../images/standalone-wabt-all-precompiles.png', bbox_inches='tight')" + "plotInterpOneEngine(df_interp,\n", + " '../images/standalone-wabt-all-precompiles.png',\n", + " 'wabt',\n", + " all_tests,\n", + " \"Wabt - all Precompiles (existing and proposed) compared\")" ] }, { @@ -3155,11 +3164,11 @@ "metadata": {}, "outputs": [], "source": [ - "plt_fig = plotThreeTestsExecTime(df_interp,\n", + "plotThreeTestsExecTime(df_interp,\n", " bn128_pairing_test_names,\n", + " '../images/standalone-wasm-interp-bn128-pairings.png',\n", " title=\"wasm interpreters compared - bn128 pairings\",\n", - " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])\n", - "plt_fig.savefig('../images/standalone-wasm-interp-bn128-pairings.png', bbox_inches='tight')" + " filter_engines=[\"life\", \"wagon\", \"v8-interpreter\"])" ] }, { @@ -3167,8 +3176,7 @@ "metadata": {}, "source": [ "#### Are interpreter engines feasible for bn128 pairings?\n", - "TODO: highlight pairing two point match in interpreter engines\n", - "\n" + "TODO: highlight pairing two point match in interpreter engines\n" ] }, { @@ -3184,9 +3192,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotCompilerStackedOneTest(df_native_and_compile, \"bn128_pairing-two_point_match_2\")\n", - "\n", - "fig_plt.savefig('../images/standalone-rust-bn128-pairings-compiler-vs-native.png', bbox_inches='tight')" + "plotCompilerStackedOneTest(df_native_and_compile,\n", + " '../images/standalone-rust-bn128-pairings-compiler-vs-native.png',\n", + " \"bn128_pairing-two_point_match_2\")" ] }, { @@ -3409,14 +3417,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_rolluprs_bignums_vs_nobignums,\n", + "plotOneTestColoredTicks(df_scout_rolluprs_bignums_vs_nobignums,\n", + " '../images/bignums-rollup-rs-bn128-pairings-with-vs-without-bignums.png',\n", " suptitle=\"rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-with-bignums\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-with-vs-without-bignums.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-with-bignums\"])" ] }, { @@ -3499,14 +3506,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_rolluprs_bignums,\n", + "plotOneTestColoredTicks(df_scout_rolluprs_bignums,\n", + " '../images/bignums-rollup-rs-bn128-pairings-wabt-with-bignums.png',\n", " suptitle=\"rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-with-bignums\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-wabt-with-bignums.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-with-bignums\"])" ] }, { @@ -3575,14 +3581,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_rollup_rustwasm_superops,\n", + "plotOneTestColoredTicks(df_scout_rollup_rustwasm_superops,\n", + " '../images/bignums-rollup-rs-bn128-pairings-superops.png',\n", " suptitle=\"rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-bignums-superops\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-superops.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-bignums-superops\"])" ] }, { @@ -3646,14 +3651,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_rolluprs_all_combos,\n", + "plotOneTestColoredTicks(df_scout_rolluprs_all_combos,\n", + " '../images/bignums-rollup-rs-bn128-pairings-all-combos.png',\n", " suptitle=\"rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-bignums-superops-fasthost-fastmont\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-all-combos.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-bignums-superops-fasthost-fastmont\"])" ] }, { @@ -3714,15 +3718,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestGrouped(df_scout_rust_vs_websnark,\n", + "plotOneTestGrouped(df_scout_rust_vs_websnark,\n", + " '../images/bignums-zkrollup-rust-vs-websnark-bn128-pairings.png',\n", " title=\"websnark vs rust - zkrollup bn128 pairings (websnark/bn128 vs rollup.rs)\",\n", " test_title=\"\",\n", " group_order=['websnark-wasm', 'rust-wasm'],\n", " sort_by=['rust-wasm'],\n", - " colors=['tab:orange', 'tab:blue'])\n", - "\n", - "\n", - "fig_plt.savefig('../images/bignums-zkrollup-rust-vs-websnark-bn128-pairings.png', bbox_inches='tight')" + " colors=['tab:orange', 'tab:blue'])" ] }, { @@ -3777,14 +3779,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_means_websnark,\n", + "plotOneTestColoredTicks(df_scout_means_websnark,\n", + " '../images/bignums-websnark-bn128-pairings-superops.png',\n", " suptitle=\"websnark-bn128-pairings - engines compared (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-websnaark-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-bignums-superops\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-websnark-bn128-pairings-superops.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-bignums-superops\"])" ] }, { @@ -3855,14 +3856,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_websnark_fasthost,\n", + "plotOneTestColoredTicks(df_scout_websnark_fasthost,\n", + " '../images/bignums-websnark-bn128-pairings-fasthost.png',\n", " suptitle=\"websnark-bn128-pairings - engines compared (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-bignums-superops-fasthost\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-websnark-bn128-pairings-fasthost.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-bignums-superops-fasthost\"])" ] }, { @@ -3920,14 +3920,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_websnark_fastmont,\n", + "plotOneTestColoredTicks(df_scout_websnark_fastmont,\n", + " '../images/bignums-websnark-bn128-pairings-fastmont.png',\n", " suptitle=\"websnark-bn128-pairings - engines compared (v8-liftoff and wabt-with-bignums)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-websnaark-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-bignums-superops-fasthost-fastmont\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-websnark-bn128-pairings-fastmont.png', bbox_inches='tight')\n" + " highlight_ticks=[\"wabt-bignums-superops-fasthost-fastmont\"])" ] }, { @@ -3950,13 +3949,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_websnark_fastmont,\n", + "plotScoutStackedTest(df_scout_websnark_fastmont,\n", + " '../images/bignums-websnark-bn128-pairings-startup-and-execution.png',\n", " suptitle=\"wasm compilers - optimizing (v8-turbofan) and single-pass (v8-liftoff) \\n vs. \\n wasm interpreter (wabt) with bignum host funcs\",\n", " suptitle_pos=1.07,\n", " subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", - " subtitle_size='xx-large')\n", - "\n", - "fig_plt.savefig('../images/bignums-websnark-bn128-pairings-startup-and-execution.png', bbox_inches='tight')\n" + " subtitle_size='xx-large')" ] }, { @@ -4030,16 +4028,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_v8_with_hostfuncs,\n", + "plotOneTestColoredTicks(df_scout_v8_with_hostfuncs,\n", + " '../images/bignums-websnark-bn128-pairings-v8-with-bignums.png',\n", " suptitle=\"websnark-bn128-pairings - engines compared (v8 without host funcs, v8 with host funcs)\",\n", " suptitle_pos=1.02,\n", " subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", " subtitle_size='xx-large',\n", - " highlight_ticks=[\"v8-liftoff-with-bignums\", \"v8-turbofan-with-bignums\"])\n", - "\n", - "\n", - "\n", - "fig_plt.savefig('../images/bignums-websnark-bn128-pairings-v8-with-bignums.png', bbox_inches='tight')" + " highlight_ticks=[\"v8-liftoff-with-bignums\", \"v8-turbofan-with-bignums\"])" ] }, { @@ -4069,7 +4064,7 @@ "metadata": {}, "outputs": [], "source": [ - "def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False):\n", + "def plotEVMvsWasm(df_evm_vs_wasm, filepath, subtitle, colors=['tab:blue', 'tab:orange'], dodge=False):\n", " f = plt.figure(figsize=(14,8))\n", " #sns.set()\n", " sns.reset_defaults() # use default colors, orange and blue\n", @@ -4096,8 +4091,9 @@ "\n", " splot.set_xticklabels(splot.get_xticklabels(), size = 14)\n", " plt.legend(fontsize='x-large', title_fontsize='40')\n", - " #f.suptitle(\"title\", fontsize=18, y=1.02)\n", - " return f\n" + " f.suptitle(subtitle, fontsize=18, y=1.02)\n", + " f.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -4239,11 +4235,10 @@ "metadata": {}, "outputs": [], "source": [ - "f = plotEVMvsWasm(df_evm_vs_wasm_bn128mul)\n", - "\n", - "#f.suptitle(\"EVM vs Wasm interpreters: bn128mul aka ECMUL \\n\\n bn128mul (Rust compiled to Wasm) vs Weierstrudel (Huff compiled to EVM)\", fontsize=18, y=1.02)\n", - "f.suptitle(\"EVM vs Wasm interpreters: ECMUL aka bn128mul \\n\\n Weierstrudel.huff (Huff compiled to EVM) vs bn128mul.rs (Rust compiled to Wasm)\", fontsize=18, y=1.02)\n", - "f.savefig('../images/evm-vs-wasm-bn128mul-huff-rust.png', bbox_inches='tight')\n" + "plotEVMvsWasm(df_evm_vs_wasm_bn128mul,\n", + " '../images/evm-vs-wasm-bn128mul-huff-rust.png',\n", + " \"EVM vs Wasm interpreters: ECMUL aka bn128mul \\n\\n Weierstrudel.huff (Huff compiled to EVM) vs bn128mul.rs (Rust compiled to Wasm)\"\n", + " )" ] }, { @@ -4349,10 +4344,10 @@ "metadata": {}, "outputs": [], "source": [ - "f = plotEVMvsWasm(df_evm_vs_wasm_mul256)\n", - "\n", - "f.suptitle(\"EVM vs Wasm interpreters: mul256-gcolvin-drag-race (Solidity to EVM) and (Rust to Wasm)\", fontsize=18, y=0.95)\n", - "f.savefig('../images/evm-vs-wasm-mul256-sol-rust.png', bbox_inches='tight')" + "plotEVMvsWasm(df_evm_vs_wasm_mul256,\n", + " '../images/evm-vs-wasm-mul256-sol-rust.png',\n", + " \"EVM vs Wasm interpreters: mul256-gcolvin-drag-race (Solidity to EVM) and (Rust to Wasm)\"\n", + " )\n" ] }, { @@ -4477,10 +4472,10 @@ "metadata": {}, "outputs": [], "source": [ - "f = plotEVMvsWasm(df_blake2b_huff_vs_wasm, colors=['tab:orange', 'tab:blue'])\n", - "\n", - "f.suptitle(\"EVM vs Wasm: BLAKE2b-8415-bytes (Huff to EVM) and (Rust to wasm)\", fontsize=18, y=0.95)\n", - "f.savefig('../images/evm-vs-wasm-blake2b-huff-rust.png', bbox_inches='tight')" + "plotEVMvsWasm(df_blake2b_huff_vs_wasm,\n", + " '../images/evm-vs-wasm-blake2b-huff-rust.png',\n", + " \"EVM vs Wasm: BLAKE2b-8415-bytes (Huff to EVM) and (Rust to wasm)\",\n", + " colors=['tab:orange', 'tab:blue'])\n" ] }, { @@ -4535,10 +4530,10 @@ "metadata": {}, "outputs": [], "source": [ - "f = plotEVMvsWasm(df_blake2b_sol_vs_huff, colors=['tab:blue', 'tab:olive'], dodge=True)\n", - "\n", - "f.suptitle(\"EVM implementations of BLAKE2b: Solidity vs Huff\", fontsize=18, y=0.95)\n", - "f.savefig('../images/evm-vs-wasm-blake2b-sol-huff.png', bbox_inches='tight')" + "plotEVMvsWasm(df_blake2b_sol_vs_huff,\n", + " '../images/evm-vs-wasm-blake2b-sol-huff.png',\n", + " \"EVM implementations of BLAKE2b: Solidity vs Huff\",\n", + " colors=['tab:blue', 'tab:olive'], dodge=True)" ] }, { @@ -4605,10 +4600,11 @@ "metadata": {}, "outputs": [], "source": [ - "f = plotEVMvsWasm(df_blake2b_sol_vs_rust, colors=['tab:orange', 'tab:olive'], dodge=False)\n", - "\n", - "f.suptitle(\"EVM vs Wasm interpreters: BLAKE2b-8415-bytes (Solidity-evm vs Rust-wasm)\", fontsize=18, y=0.95)\n", - "f.savefig('../images/evm-vs-wasm-blake2b-sol-rust.png', bbox_inches='tight')" + "plotEVMvsWasm(df_blake2b_sol_vs_rust,\n", + " '../images/evm-vs-wasm-blake2b-sol-rust.png',\n", + " \"EVM vs Wasm interpreters: BLAKE2b-8415-bytes (Solidity-evm vs Rust-wasm)\",\n", + " colors=['tab:orange', 'tab:olive'], \n", + " dodge=False)" ] }, { @@ -4710,7 +4706,8 @@ "\n", "\n", "f.suptitle(\"EVM vs Wasm: BLAKE2b-8415-bytes \\n\\n Huff-evm vs Solidity-evm vs Rust-wasm\", fontsize=18, y=1.02)\n", - "f.savefig('../images/evm-vs-wasm-blake2b-huff-sol-rust.png', bbox_inches='tight')" + "f.savefig('../images/evm-vs-wasm-blake2b-huff-sol-rust.png', bbox_inches='tight')\n", + "plt.close('all')" ] }, { @@ -4790,14 +4787,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicks(df_scout_bls12,\n", + "plotOneTestColoredTicks(df_scout_bls12,\n", + " '../images/bignums-bls12-pairings-rust-vs-wasm-total-time.png',\n", " suptitle=\"BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)\",\n", " suptitle_pos=1.02,\n", " #subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", " #subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-with-bignums\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-pairings-rust-vs-wasm-total-time.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-with-bignums\"])" ] }, { @@ -4806,14 +4802,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_bls12,\n", + "plotScoutStackedTest(df_scout_bls12,\n", + " '../images/bignums-bls12-pairings-rust-vs-wasm-exec-startup-time.png',\n", " suptitle=\"BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)\",\n", " suptitle_pos=1.07,\n", " #subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", " #subtitle_size='xx-large'\n", - " )\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-pairings-rust-vs-wasm-exec-startup-time.png', bbox_inches='tight')" + " )" ] }, { @@ -4870,14 +4865,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestColoredTicksBLS(df_scout_bls12_hostfunc_variations,\n", + "plotOneTestColoredTicksBLS(df_scout_bls12_hostfunc_variations,\n", + " '../images/bignums-bls12-pairings-host-func-variations-total-time.png',\n", " suptitle=\"BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)\",\n", " suptitle_pos=1.02,\n", " #subtitle=\"ecpairing-zkrollup-rust-wasm-bn128-two-pairings\\n\",\n", " #subtitle_size='xx-large',\n", - " highlight_ticks=[\"wabt-with-bignums\"])\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-pairings-host-func-variations-total-time.png', bbox_inches='tight')" + " highlight_ticks=[\"wabt-with-bignums\"])" ] }, { @@ -4886,14 +4880,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_scout_bls12_hostfunc_variations,\n", + "plotScoutStackedTest(df_scout_bls12_hostfunc_variations,\n", + " '../images/bignums-bls12-pairings-host-func-variations-exec-startup-time.png',\n", " suptitle=\"BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)\",\n", " suptitle_pos=1.07,\n", " #subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", " #subtitle_size='xx-large'\n", - " )\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-pairings-host-func-variations-exec-startup-time.png', bbox_inches='tight')" + " )" ] }, { @@ -4910,15 +4903,6 @@ "## BLS12 - wabt vs wabt-with-bignums vs native" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "plt.style.use('seaborn-white')\n" - ] - }, { "cell_type": "code", "execution_count": null, @@ -4953,18 +4937,14 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_wabt_bls12,\n", + "plotScoutStackedTest(df_wabt_bls12,\n", + " '../images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png',\n", " suptitle=\"BLS12-381 two-point pairing check\",\n", " suptitle_pos=0.94,\n", " subtitle=\"\",\n", " #subtitle=\"wasmnark (on wabt and wabt-with-bigums) vs eip1962 (rust-native)\\n\",\n", " #subtitle_size='xx-large'\n", - " )\n", - "\n", - "\n", - "fig_plt.grid(False)\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png', bbox_inches='tight')" + " )" ] }, { @@ -4972,9 +4952,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "plt.style.use('ggplot')" - ] + "source": [] }, { "cell_type": "code", @@ -5033,14 +5011,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_fizzy_bls12,\n", + "plotScoutStackedTest(df_fizzy_bls12,\n", + " '../images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png',\n", " suptitle=\"BLS12-381 two-point pairing check (fizzy vs wabt, rust-eip1962 vs wasmsnark)\",\n", " suptitle_pos=1.07,\n", " #subtitle=\"ecpairing-zkrollup-websnark-bn128-two-pairings\\n\",\n", " #subtitle_size='xx-large'\n", - " )\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png', bbox_inches='tight')" + " )" ] }, { @@ -5090,14 +5067,13 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotScoutStackedTest(df_bls12_synth_loop,\n", + "plotScoutStackedTest(df_bls12_synth_loop,\n", + " '../images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png',\n", " suptitle=\"BLS12-381 synthetic loop (fizzy vs wabt - wasmsnark)\",\n", " suptitle_pos=0.96,\n", " subtitle=\"\",\n", " #subtitle_size='xx-large'\n", - " )\n", - "\n", - "fig_plt.savefig('../images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png', bbox_inches='tight')" + " )" ] }, { @@ -5128,16 +5104,14 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestGroupedExexTime(df_bls12_synth_vs_pairing,\n", + "plotOneTestGroupedExexTime(df_bls12_synth_vs_pairing,\n", + " '../images/evm384-bls12-synth-loop-vs-pairings.png',\n", " #title=\"BLS12-381 two pairings vs synthetic loop - wasmsnark (fizzy vs wabt)\",\n", " title=\"Figure 2: BLS12-381 two pairings vs synthetic loop\",\n", " test_title=\"\",\n", " group_order=['bls12-synth-loop', 'bls12-two-pairings'],\n", " sort_by=['bls12-synth-loop'],\n", - " colors=['tab:orange', 'tab:blue'])\n", - "\n", - "\n", - "fig_plt.savefig('../images/evm384-bls12-synth-loop-vs-pairings.png', bbox_inches='tight')" + " colors=['tab:orange', 'tab:blue'])" ] }, { @@ -5344,7 +5318,7 @@ " return df_benchdata.loc[engine]['time'].max()\n", "\n", "\n", - "def plotTimeVsGas(df_benchdata, title=\"\"):\n", + "def plotTimeVsGas(df_benchdata, filepath, title=\"\"):\n", " #sorted_engines = sorted(['evmone384', 'rust-native'], key=lambda x: byEngineExecTime(df_benchdata, x))\n", " columns_to_plot = ['time']\n", " df_plotdata = df_benchdata.copy()\n", @@ -5392,7 +5366,8 @@ " \n", " f.suptitle(title, fontsize=16, y=1.22)\n", " f.subplots_adjust(hspace=0.5)\n", - " return f\n" + " f.savefig(filepath, bbox_inches='tight')\n", + " plt.close('all')\n" ] }, { @@ -5401,9 +5376,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotTimeVsGas(df_evm384_native, \"bls12-381 pairings: rust-native precompile vs evm384 synthetic loop\")\n", - "\n", - "fig_plt.savefig('../images/evm384-bls12-synth-loop-vs-native-rust.png', bbox_inches='tight')" + "plotTimeVsGas(df_evm384_native,\n", + " '../images/evm384-bls12-synth-loop-vs-native-rust.png',\n", + " \"bls12-381 pairings: rust-native precompile vs evm384 synthetic loop\")" ] }, { @@ -5570,11 +5545,10 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestUsingTimeCol(df_evm384_wasm_native,\n", + "plotOneTestUsingTimeCol(df_evm384_wasm_native,\n", + " '../images/evm384-bls12-pairings-synth-loop-rust-wasm.png',\n", " suptitle=\"BLS12-381 pairings and synthetic loop - rust-native, wasm, evm384\",\n", - " suptitle_pos=1.02)\n", - "\n", - "fig_plt.savefig('../images/evm384-bls12-pairings-synth-loop-rust-wasm.png', bbox_inches='tight')" + " suptitle_pos=1.02)" ] }, { @@ -5632,12 +5606,10 @@ "metadata": {}, "outputs": [], "source": [ - "fig_plt = plotOneTestUsingTimeCol(df_evm384_wasm_synth_loop,\n", + "plotOneTestUsingTimeCol(df_evm384_wasm_synth_loop,\n", + " '../images/evm384-bls12-synth-loop-wasm.png',\n", " suptitle=\"BLS12-381 synthetic loop - wasm and evm384\",\n", - " suptitle_pos=1.02)\n", - "\n", - "fig_plt.savefig('../images/evm384-bls12-synth-loop-wasm.png', bbox_inches='tight')\n", - "fig_plt.show()" + " suptitle_pos=1.02)" ] }, { @@ -5692,16 +5664,7 @@ "metadata": {}, "outputs": [], "source": [ - "df_evm384_wasm_native_tldr" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_wasm_native_tldr = df_evm384_wasm_native_tldr.drop(df_evm384_wasm_native_tldr[df_evm384_wasm_native_tldr['engine'] == 'fizzy-with-bignums'].index)\n" + "df_evm384_wasm_native_tldr = df_evm384_wasm_native_tldr.drop(df_evm384_wasm_native_tldr[df_evm384_wasm_native_tldr['engine'] == 'fizzy-with-bignums'].index)" ] }, { @@ -5720,33 +5683,13 @@ "outputs": [], "source": [ "df_evm384_wasm_native_tldr.replace('bls12-eip1962-rust-native-two-pairings', 'Native two-pairings (Rust)', inplace=True)\n", - "df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v3', 'EVM384 synth-loop-v3 (Yul)', inplace=True)\n", - "df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v2', 'EVM384 synth-loop-v2 (Yul)', inplace=True)\n", - "df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v1', 'EVM384 synth-loop-v1 (Yul)', inplace=True)\n", + "df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v2', 'EVM384 synth-loop-v1 (Yul)', inplace=True)\n", + "df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v1', 'EVM384 synth-loop-v2 (Yul)', inplace=True)\n", "df_evm384_wasm_native_tldr.replace('bls12-synth-loop', 'Wasm synth-loop (wasmsnark)', inplace=True)\n", "df_evm384_wasm_native_tldr.replace('bls12-two-pairings', 'Wasm two-pairings (wasmsnark)', inplace=True)\n", "#df_evm384_wasm_native_tldr.replace('blake2b-8kb.huff.evm', 'EVM (Huff)', inplace=True)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_wasm_synth_pairing_yul = df_evm384_wasm_native_tldr.copy()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# drop rust-native - this chart focuses on synth loop vs pairing (and evmone384 synth loop)\n", - "df_evm384_wasm_synth_pairing_yul = df_evm384_wasm_synth_pairing_yul.drop(df_evm384_wasm_synth_pairing_yul[df_evm384_wasm_synth_pairing_yul['engine'] == 'rust-native'].index)\n" - ] - }, { "cell_type": "code", "execution_count": null, @@ -5756,8 +5699,8 @@ "f = plt.figure(figsize=(14,8))\n", "sns.reset_defaults() # use default colors, orange and blue\n", "splot = sns.barplot(x='engine', y='time', hue='bench_name', dodge=True, ci=None,\n", - " palette=['tab:blue', 'tab:olive', 'tab:purple', 'tab:brown', 'tab:cyan'],\n", - " data=df_evm384_wasm_synth_pairing_yul)\n", + " palette=['tab:orange', 'tab:blue', 'tab:olive', 'tab:purple', 'tab:brown'],\n", + " data=df_evm384_wasm_native_tldr)\n", "\n", "\n", "\n", @@ -5774,7 +5717,6 @@ "olive_bars_rgba = (0.6622549019607844, 0.6651960784313725, 0.2093137254901961, 1.0)\n", "purple_bars_rgba = (0.5784313725490194, 0.446078431372549, 0.6990196078431372, 1.0)\n", "brown_bars_rgba = (0.5171568627450981, 0.3583333333333334, 0.3259803921568628, 1.0)\n", - "cyan_bars_rgba = (0.180392156862745, 0.6715686274509803, 0.7215686274509805, 1.0)\n", "\n", "\n", "for patch in splot.patches:\n", @@ -5782,385 +5724,34 @@ " # factor 1.3 to make bars 30% wider?\n", " diff = current_width*1.3 - current_width\n", "\n", - " # couldn't find a way to look up patch color names nor covert RGB to name,\n", + " # orange - couldn't find a way to look up patch color names nor covert RGB to name,\n", " # so we look up the bar groups using these HSLA(?) values like (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0)\n", + " if patch.get_facecolor() == orange_bars_rgba:\n", + " diff = current_width*2 - current_width\n", + " patch.set_width(current_width*1.3)\n", + " patch.set_x(patch.get_x() + diff * 1.85)\n", "\n", " #blue\n", " if patch.get_facecolor() == blue_bars_rgba:\n", " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() + diff * 3.4)\n", + " patch.set_x(patch.get_x() + diff * 1.7)\n", "\n", " #olive\n", " if patch.get_facecolor() == olive_bars_rgba:\n", " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() + diff * 3.4)\n", - "\n", - " # purple\n", - " if patch.get_facecolor() == purple_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", - "\n", - " # brown\n", - " if patch.get_facecolor() == brown_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", - " \n", - " # cyan\n", - " if patch.get_facecolor() == cyan_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", - " \n", - " \n", - " #print(dir(patch))\n", - " #print(patch)\n", - " #print(patch.get_facecolor())\n", - "\n", - "\n", - "# annotate the bars with the ms values\n", - "for p in splot.patches:\n", - " splot.annotate(\n", - " toMs(p.get_height()),\n", - " (p.get_x() + p.get_width() / 2., p.get_height()),\n", - " ha = 'center', va = 'center',\n", - " xytext = (0, 10),\n", - " textcoords = 'offset points')\n", - "\n", - "\n", - "# adjust legend placement\n", - "plt.legend(fontsize='x-large', title_fontsize='40', loc='upper left')\n", - "#leg = splot.get_legend()\n", - "#leg.set_bbox_to_anchor([0.212,0.95])\n", - "\n", - "splot.set_xticklabels(splot.get_xticklabels(), size = 14)\n", - "splot.set(xlabel='')\n", - "\n", - "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)\", fontsize=18, y=0.96)\n", - "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)\", fontsize=18, y=0.96)\n", - "f.savefig('../images/evm384-wasm-native-pairings-and-synth-loop.png', bbox_inches='tight')\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## just wasm - synth loop vs pairing" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_wasm = df_evm384_wasm_native_tldr.copy()\n", - "# drop rust-native - this chart focuses on synth loop vs pairing (and evmone384 synth loop)\n", - "df_evm384_synth_wasm = df_evm384_synth_wasm.drop(df_evm384_synth_wasm[df_evm384_synth_wasm['engine'] == 'rust-native'].index)\n", - "\n", - "df_evm384_synth_wasm = df_evm384_synth_wasm.drop(df_evm384_synth_wasm[df_evm384_synth_wasm['engine'] == 'evmone384'].index)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_wasm" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#df_evm384_synth_wasm.loc[(df_evm384_synth_wasm['bench_name'] == 'Wasm two-pairings (wasmsnark)'), 'engine'] = \"wasm-two-pairings\"\n", - "#df_evm384_synth_wasm.loc[(df_evm384_synth_wasm['bench_name'] == 'Wasm synth-loop (wasmsnark)'), 'engine'] = \"wasm-synth-loop\"\n", - "\n", - "df_evm384_synth_wasm.loc[(df_evm384_synth_wasm['bench_name'] == 'Wasm two-pairings (wasmsnark)'), 'engine'] = \"wabt-with-bignums (two-pairings)\"\n", - "df_evm384_synth_wasm.loc[(df_evm384_synth_wasm['bench_name'] == 'Wasm synth-loop (wasmsnark)'), 'engine'] = \"wabt-with-bignums (synth-loop)\"\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_wasm" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f = plt.figure(figsize=(14,8))\n", - "sns.reset_defaults() # use default colors, orange and blue\n", - "splot = sns.barplot(x='engine', y='time', hue='bench_name', dodge=True, ci=None,\n", - " palette=['tab:blue', 'tab:olive', 'tab:purple', 'tab:brown', 'tab:cyan'],\n", - " data=df_evm384_synth_wasm)\n", - "\n", - "\n", - "\n", - "# this customizes the widths of each bar-group. Because orange bars (wasm) stand alone,\n", - "# versus blue and olive that are grouped together (evm-huff, evm-sol), but the default\n", - "# widths are all the same, the orange bars are too skinny.\n", - "# This makes the orange bars fatter (`current_width*2`) than the blue and olive bars (`current_width*1.3`)\n", - "\n", - "# It also adjusts the x position of the bars so that they're centered (by default they were positioned\n", - "# as if all three groups would appear in every column)\n", - "\n", - "orange_bars_rgba = (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0)\n", - "blue_bars_rgba = (0.19460784313725488, 0.45343137254901944, 0.632843137254902, 1.0)\n", - "olive_bars_rgba = (0.6622549019607844, 0.6651960784313725, 0.2093137254901961, 1.0)\n", - "purple_bars_rgba = (0.5784313725490194, 0.446078431372549, 0.6990196078431372, 1.0)\n", - "brown_bars_rgba = (0.5171568627450981, 0.3583333333333334, 0.3259803921568628, 1.0)\n", - "cyan_bars_rgba = (0.180392156862745, 0.6715686274509803, 0.7215686274509805, 1.0)\n", - "\n", - "\n", - "for patch in splot.patches:\n", - " current_width = patch.get_width()\n", - " diff = current_width*1.3 - current_width\n", - "\n", - " # couldn't find a way to look up patch color names nor covert RGB to name,\n", - " # so we look up the bar groups using these HSLA(?) values like (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0)\n", - "\n", - " #blue\n", - " if patch.get_facecolor() == blue_bars_rgba:\n", - " patch.set_width(current_width*0.7)\n", - " patch.set_x(patch.get_x() + diff * 2.1)\n", - "\n", - " #olive\n", - " if patch.get_facecolor() == olive_bars_rgba:\n", - " patch.set_width(current_width*0.7)\n", - " patch.set_x(patch.get_x() - diff * 1.1)\n", + " patch.set_x(patch.get_x() + diff * 1.7)\n", "\n", " # purple\n", " if patch.get_facecolor() == purple_bars_rgba:\n", " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", + " patch.set_x(patch.get_x() - diff * 5.0)\n", "\n", " # brown\n", " if patch.get_facecolor() == brown_bars_rgba:\n", " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", - " \n", - " # cyan\n", - " if patch.get_facecolor() == cyan_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", + " patch.set_x(patch.get_x() - diff * 5.0)\n", " \n", - " \n", - " #print(dir(patch))\n", - " #print(patch)\n", - " #print(patch.get_facecolor())\n", - "\n", - "\n", - "# annotate the bars with the ms values\n", - "for p in splot.patches:\n", - " splot.annotate(\n", - " toMs(p.get_height()),\n", - " (p.get_x() + p.get_width() / 2., p.get_height()),\n", - " ha = 'center', va = 'center',\n", - " xytext = (0, 10),\n", - " textcoords = 'offset points')\n", - "\n", - "\n", - "# adjust legend placement\n", - "plt.legend(fontsize='x-large', title_fontsize='40', loc='upper left')\n", - "#leg = splot.get_legend()\n", - "#leg.set_bbox_to_anchor([0.212,0.95])\n", - "\n", - "splot.set_xticklabels(splot.get_xticklabels(), size = 14)\n", - "splot.set(xlabel='')\n", "\n", - "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)\", fontsize=18, y=0.96)\n", - "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)\", fontsize=18, y=0.96)\n", - "f.savefig('../images/evm384-wasm-pairings-vs-synth-loop.png', bbox_inches='tight')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## just evmone384 - v1 v2 v3" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_v1v2v3 = df_evm384_wasm_native_tldr.copy()\n", - "# drop rust-native - this chart focuses on synth loop vs pairing (and evmone384 synth loop)\n", - "df_evm384_synth_v1v2v3 = df_evm384_synth_v1v2v3.drop(df_evm384_synth_v1v2v3[df_evm384_synth_v1v2v3['engine'] == 'rust-native'].index)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_v1v2v3" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_v1v2v3 = df_evm384_synth_v1v2v3.drop(df_evm384_synth_v1v2v3[df_evm384_synth_v1v2v3['engine'] == 'wabt-with-bignums'].index)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_v1v2v3" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#df_evm384_synth_v1v2v3.replace('evm384-synth-loop-v3', 'EVM384 synth-loop-v3 (Yul)', inplace=True)\n", - "#df_evm384_synth_v1v2v3.replace('evm384-synth-loop-v2', 'EVM384 synth-loop-v2 (Yul)', inplace=True)\n", - "#df_evm384_synth_v1v2v3.replace('evm384-synth-loop-v1', 'EVM384 synth-loop-v1 (Yul)', inplace=True)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_v1v2v3.loc[(df_evm384_synth_v1v2v3['bench_name'] == 'EVM384 synth-loop-v3 (Yul)'), 'engine'] = \"evmone-evm384-v3\"\n", - "df_evm384_synth_v1v2v3.loc[(df_evm384_synth_v1v2v3['bench_name'] == 'EVM384 synth-loop-v2 (Yul)'), 'engine'] = \"evmone-evm384-v2\"\n", - "df_evm384_synth_v1v2v3.loc[(df_evm384_synth_v1v2v3['bench_name'] == 'EVM384 synth-loop-v1 (Yul)'), 'engine'] = \"evmone-evm384-v1\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_synth_v1v2v3" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "f = plt.figure(figsize=(14,8))\n", - "sns.reset_defaults() # use default colors, orange and blue\n", - "splot = sns.barplot(x='engine', y='time', hue='bench_name', dodge=True, ci=None,\n", - " palette=['tab:purple', 'tab:brown', 'tab:cyan'],\n", - " data=df_evm384_synth_v1v2v3)\n", - "\n", - "\n", - "\n", - "# this customizes the widths of each bar-group. Because orange bars (wasm) stand alone,\n", - "# versus blue and olive that are grouped together (evm-huff, evm-sol), but the default\n", - "# widths are all the same, the orange bars are too skinny.\n", - "# This makes the orange bars fatter (`current_width*2`) than the blue and olive bars (`current_width*1.3`)\n", - "\n", - "# It also adjusts the x position of the bars so that they're centered (by default they were positioned\n", - "# as if all three groups would appear in every column)\n", - "\n", - "orange_bars_rgba = (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0)\n", - "blue_bars_rgba = (0.19460784313725488, 0.45343137254901944, 0.632843137254902, 1.0)\n", - "olive_bars_rgba = (0.6622549019607844, 0.6651960784313725, 0.2093137254901961, 1.0)\n", - "purple_bars_rgba = (0.5784313725490194, 0.446078431372549, 0.6990196078431372, 1.0)\n", - "brown_bars_rgba = (0.5171568627450981, 0.3583333333333334, 0.3259803921568628, 1.0)\n", - "cyan_bars_rgba = (0.180392156862745, 0.6715686274509803, 0.7215686274509805, 1.0)\n", - "\n", - "\n", - "for patch in splot.patches:\n", - " current_width = patch.get_width()\n", - " # factor 1.3 to make bars 30% wider?\n", - " diff = current_width*1.3 - current_width\n", - "\n", - " # couldn't find a way to look up patch color names nor covert RGB to name,\n", - " # so we look up the bar groups using these HSLA(?) values like (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0)\n", - "\n", - " #blue\n", - " if patch.get_facecolor() == purple_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() + diff * 3.4)\n", - "\n", - " #olive\n", - " if patch.get_facecolor() == brown_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() + diff * 0.0)\n", - "\n", - " # purple\n", - " if patch.get_facecolor() == cyan_bars_rgba:\n", - " patch.set_width(current_width*1.0)\n", - " patch.set_x(patch.get_x() - diff * 3.4)\n", - " \n", - " \n", " #print(dir(patch))\n", " #print(patch)\n", " #print(patch.get_facecolor())\n", @@ -6186,7 +5777,8 @@ "\n", "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)\", fontsize=18, y=0.96)\n", "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)\", fontsize=18, y=0.96)\n", - "f.savefig('../images/evm384-synth-loop-v1-v2-v3.png', bbox_inches='tight')\n" + "f.savefig('../images/evm384-wasm-native-pairings-and-synth-loop.png', bbox_inches='tight')\n", + "plt.close('all')" ] }, { @@ -6196,20 +5788,6 @@ "outputs": [], "source": [] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -6226,15 +5804,6 @@ "df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr.copy()" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df_evm384_wasm_native_tldr_adjusted" - ] - }, { "cell_type": "code", "execution_count": null, @@ -6263,8 +5832,7 @@ "outputs": [], "source": [ "df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr_adjusted.drop(df_evm384_wasm_native_tldr_adjusted[df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'Wasm synth-loop (wasmsnark)'].index)\n", - "df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr_adjusted.drop(df_evm384_wasm_native_tldr_adjusted[df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'EVM384 synth-loop-v1 (Yul)'].index)\n", - "df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr_adjusted.drop(df_evm384_wasm_native_tldr_adjusted[df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'EVM384 synth-loop-v2 (Yul)'].index)" + "df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr_adjusted.drop(df_evm384_wasm_native_tldr_adjusted[df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'EVM384 synth-loop-v1 (Yul)'].index)" ] }, { @@ -6282,18 +5850,9 @@ "metadata": {}, "outputs": [], "source": [ - "df_evm384_wasm_native_tldr_adjusted.loc[(df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'EVM384 synth-loop-v3 (Yul)'), 'engine'] = \"evmone-evm384-v3\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "evm384_legend_label = \"EVM384 estimate (after synthetic adjustment factor of {:0.2f}x)\".format(adjustment_factor)\n", + "evm384_legend_label = \"EVM384 estimate (synthetic adjustment factor {:0.2f})\".format(adjustment_factor)\n", "\n", - "df_evm384_wasm_native_tldr_adjusted.replace('EVM384 synth-loop-v3 (Yul)', evm384_legend_label, inplace=True)" + "df_evm384_wasm_native_tldr_adjusted.replace('EVM384 synth-loop-v2 (Yul)', evm384_legend_label, inplace=True)" ] }, { @@ -6374,7 +5933,8 @@ "\n", "#f.suptitle(\"Two-pairings (Rust-native, wasm) vs Estimated-two-pairings (evm384 adjusted-synth-loop)\", fontsize=18, y=0.96)\n", "#f.suptitle(\"BLS12-381: Estimated runtime for two pairings on EVM384\", fontsize=18, y=0.96)\n", - "f.savefig('../images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png', bbox_inches='tight')\n" + "f.savefig('../images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png', bbox_inches='tight')\n", + "plt.close('all')" ] }, { @@ -6385,7 +5945,8 @@ "source": [ "\n", "# test to make sure that scout wasm3 data is present\n", - "test_scout_wasm3_plot = plotOneTestColoredTicks(df_scout_data[df_scout_data['engine'].isin(['wasm3-with-bignums'])],)\n" + "plotOneTestColoredTicks(df_scout_data[df_scout_data['engine'].isin(['wasm3-with-bignums'])],\n", + " '../images/.scout_wasm3_test1_png')\n" ] }, { @@ -6396,7 +5957,8 @@ "source": [ "\n", "# test to make sure that scout_wamr.c data is present\n", - "test_scout_wasm3_plot = plotOneTestColoredTicks(df_scout_data[df_scout_data['engine'].isin(['wasm3-with-bignums'])],)\n" + "plotOneTestColoredTicks(df_scout_data[df_scout_data['engine'].isin(['wasm3-with-bignums'])],\n", + " '../images/.scout_wasm3_test2_png')\n" ] }, { @@ -6413,13 +5975,6 @@ "outputs": [], "source": [] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": null, diff --git a/notebooks/wasm-engines.py b/notebooks/wasm-engines.py index 8ce2c8b..27d2b71 100644 --- a/notebooks/wasm-engines.py +++ b/notebooks/wasm-engines.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -# In[1]: +# In[ ]: #%matplotlib widget @@ -19,7 +19,7 @@ from collections import defaultdict -# In[2]: +# In[ ]: plt.style.use('ggplot') @@ -27,7 +27,7 @@ COLORS_DEFAULT ={'blue': '#348ABD', 'red': '#E24A33'} -# In[3]: +# In[ ]: pd.set_option('display.max_rows', 1000) @@ -39,7 +39,7 @@ -# In[4]: +# In[ ]: # conda install -c phlya adjusttext @@ -48,7 +48,7 @@ # ## csv result files directory name and file names -# In[5]: +# In[ ]: CSV_RESULT_DIR = "../benchmark_results_data" @@ -62,10 +62,10 @@ # ## To add a new engine, add the engine name used in the csv file to this list -# In[6]: +# In[ ]: -INTERPRETER_ENGINES = ['life', 'ssvm', 'wagon', 'wasmi', 'vanilla-wabt', 'wabt', 'v8-interpreter', 'wasm3', 'wamr-interp', 'fizzy'] +INTERPRETER_ENGINES = ['life', 'ssvm', 'wagon', 'wasmi', 'wabt', 'v8-interpreter', 'wasm3', 'wamr-interp', 'fizzy'] COMPILER_ENGINES = ['lifePolymerase', 'wasmtime', 'wavm', 'v8-liftoff', 'v8-turbofan', 'asmble', 'wamr-jit', 'wamr-aot'] wasm_vm_names = INTERPRETER_ENGINES + COMPILER_ENGINES @@ -79,7 +79,7 @@ # ## Helper funcs -# In[7]: +# In[ ]: def toMs(secs): @@ -96,7 +96,7 @@ def toMs(secs): return "{}s".format(round(secs, 2)) -# In[8]: +# In[ ]: def labelBarHeights(ax, to_ms=True, small=False, to_factor=False, lower_y_bound=True): @@ -157,7 +157,7 @@ def labelBarHeights(ax, to_ms=True, small=False, to_factor=False, lower_y_bound= return labels -# In[9]: +# In[ ]: def labelBarWidths(ax, to_ms=True, to_factor=False, to_kb=False, round_places=None): @@ -197,7 +197,7 @@ def labelBarWidths(ax, to_ms=True, to_factor=False, to_kb=False, round_places=No weight="bold") -# In[10]: +# In[ ]: def adjust_text_labels(labels, ax=None): @@ -205,7 +205,7 @@ def adjust_text_labels(labels, ax=None): -# In[11]: +# In[ ]: def read_results(file_name): @@ -220,7 +220,7 @@ def read_results(file_name): -# In[12]: +# In[ ]: def filterDfEngines(df_data, engines): @@ -245,7 +245,7 @@ def filterDfEngines(df_data, engines): # ## print benchmark machine cpu type -# In[13]: +# In[ ]: with open(join(CSV_RESULT_DIR, "cpuinfo.txt"), 'r') as cpuinfofile: @@ -266,13 +266,13 @@ def filterDfEngines(df_data, engines): # ## Import EVM engine results -# In[14]: +# In[ ]: df_evm_raw = read_results(join(CSV_RESULT_DIR, EVM_RESULT_FILE)) -# In[15]: +# In[ ]: df_evm_raw @@ -292,7 +292,7 @@ def filterDfEngines(df_data, engines): # ## Import scout engine results -# In[16]: +# In[ ]: df_scout_data = read_results(join(CSV_RESULT_DIR, SCOUT_RESULT_FILE)) @@ -318,7 +318,7 @@ def filterDfEngines(df_data, engines): -# In[17]: +# In[ ]: ## we aren't using this chart style anymore. replaced by plotThreeTestsGrouped() @@ -352,7 +352,7 @@ def plotTwoEngines(df_benches, two_engines, title="Title"): -# In[18]: +# In[ ]: def plotThreeTestsGrouped(df_benches, three_tests, title="Title"): @@ -403,7 +403,7 @@ def plotThreeTestsGrouped(df_benches, three_tests, title="Title"): # ## TODO: temporarily disabled until new C_ewasm data -# In[19]: +# In[ ]: #fig_plt = plotThreeTestsGrouped(df_scout_data, ["blake2b_64", "blake2b_256", "blake2b_1024"], "blake2b C implementations compared") @@ -417,7 +417,7 @@ def plotThreeTestsGrouped(df_benches, three_tests, title="Title"): -# In[20]: +# In[ ]: #fig_plt = plotThreeTestsGrouped(df_scout_data, ["sha256_64", "sha256_256", "sha256_1024"], "sha256 C implementations compared") @@ -431,7 +431,7 @@ def plotThreeTestsGrouped(df_benches, three_tests, title="Title"): -# In[21]: +# In[ ]: #fig_plt = plotThreeTestsGrouped(df_scout_data, ["keccak256_64", "keccak256_256", "keccak256_1024"], "keccak256 C implementations compared") @@ -477,11 +477,11 @@ def plotThreeTestsGrouped(df_benches, three_tests, title="Title"): -# In[22]: +# In[ ]: # non-stacked bar chart, for only plotting exec time or total time -def plotOneTestUsingTimeCol(df_data, time_col_name="time", suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium'): +def plotOneTestUsingTimeCol(df_data, filepath, time_col_name="time", suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium'): plt.style.use('ggplot') plt.figure() df_total_times = df_data.copy() @@ -492,7 +492,8 @@ def plotOneTestUsingTimeCol(df_data, time_col_name="time", suptitle="title", sup ax.xaxis.set_tick_params(labelrotation=60, labelsize=12) adjust_text_labels(labelBarHeights(ax)) plt.suptitle(suptitle, fontsize=18, y=suptitle_pos) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') # In[ ]: @@ -501,11 +502,11 @@ def plotOneTestUsingTimeCol(df_data, time_col_name="time", suptitle="title", sup -# In[23]: +# In[ ]: # non-stacked bar chart, for only plotting exec time or total time -def plotOneTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium'): +def plotOneTest(df_data, filepath, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium'): plt.style.use('ggplot') plt.figure() df_total_times = df_data[['exec_time', 'parse_time']].copy() @@ -518,14 +519,15 @@ def plotOneTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle="subchart ax.xaxis.set_tick_params(labelrotation=60, labelsize=12) adjust_text_labels(labelBarHeights(ax)) plt.suptitle(suptitle, fontsize=18, y=suptitle_pos) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[24]: +# In[ ]: # non-stacked bar chart, for only plotting exec time or total time -def plotOneTestColoredTicksBLS(df_data, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium', highlight_ticks=None): +def plotOneTestColoredTicksBLS(df_data, filepath, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium', highlight_ticks=None): #f = plt.figure(figsize=[14, 8]) #plt.figure(figsize=[14, 8]) plt.style.use('ggplot') @@ -550,14 +552,15 @@ def plotOneTestColoredTicksBLS(df_data, suptitle="title", suptitle_pos=1.00, sub #[i.set_color('tab:green') for i in plt.gca().get_xticklabels() if i.get_text() == highlight_tick] adjust_text_labels(labelBarHeights(ax)) plt.suptitle(suptitle, fontsize=18, y=suptitle_pos) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[25]: +# In[ ]: # non-stacked bar chart, for only plotting exec time or total time -def plotOneTestColoredTicks(df_data, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium', highlight_ticks=None): +def plotOneTestColoredTicks(df_data, filepath, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium', highlight_ticks=None): #f = plt.figure(figsize=[14, 8]) #plt.figure(figsize=[14, 8]) plt.style.use('ggplot') @@ -582,13 +585,14 @@ def plotOneTestColoredTicks(df_data, suptitle="title", suptitle_pos=1.00, subtit #[i.set_color('tab:green') for i in plt.gca().get_xticklabels() if i.get_text() == highlight_tick] adjust_text_labels(labelBarHeights(ax)) plt.suptitle(suptitle, fontsize=18, y=suptitle_pos) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[26]: +# In[ ]: -def plotOneTestGrouped(df_1, test_title="test_title", title="plot Title", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None): +def plotOneTestGrouped(df_1, filepath, test_title="test_title", title="plot Title", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None): # to group by engine, pivot to `columns='engine'` #df_1 = pd.pivot_table(df_1, values='exec_time', columns=['engine'], index=['bench_name'], aggfunc=np.mean) # group by bench name @@ -608,13 +612,14 @@ def plotOneTestGrouped(df_1, test_title="test_title", title="plot Title", colors adjust_text_labels(labelBarHeights(ax)) plt.suptitle(title, fontsize=16, y=0.98) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[27]: +# In[ ]: -def plotOneTestGroupedExexTime(df_1, test_title="test_title", title="plot Title", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None): +def plotOneTestGroupedExexTime(df_1, filepath, test_title="test_title", title="plot Title", colors=['tab:blue', 'tab:orange'], sort_by='websnark-bn128-two-pairings', group_order=None): # to group by engine, pivot to `columns='engine'` #df_1 = pd.pivot_table(df_1, values='exec_time', columns=['engine'], index=['bench_name'], aggfunc=np.mean) # group by bench name @@ -634,7 +639,8 @@ def plotOneTestGroupedExexTime(df_1, test_title="test_title", title="plot Title" adjust_text_labels(labelBarHeights(ax)) plt.suptitle(title, fontsize=16, y=0.98) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') # In[ ]: @@ -643,10 +649,10 @@ def plotOneTestGroupedExexTime(df_1, test_title="test_title", title="plot Title" -# In[28]: +# In[ ]: -def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium'): +def plotScoutStackedTest(df_data, filepath, suptitle="title", suptitle_pos=1.00, subtitle="subchart", subtitle_size='medium'): #plt.figure(figsize=[12,7]) plt.figure() # for some reason, exec_time needs to come first for the stacked chart to display correctly @@ -660,8 +666,9 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= adjust_text_labels(labelBarHeights(ax, lower_y_bound=False)) ax.legend(labels=["execution time", "startup time"]) plt.suptitle(suptitle, fontsize=18, y=suptitle_pos) - #ax.autoscale(enable=True) - return plt + #ax.autoscale(enable=True) + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') # In[ ]: @@ -678,7 +685,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= # ## Plot biturbo benchmark: biturbo-token-eth1-mainnet-stateless-block-hexary-trie-keccak256-multiproof -# In[29]: +# In[ ]: df_scout_biturbo_token = df_scout_data[df_scout_data['bench_name'] == 'biturbo-token-eth1-mainnet-stateless-block-hexary-trie-keccak256-multiproof'] @@ -694,17 +701,16 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[30]: +# In[ ]: -fig_plt = plotOneTest(df_scout_means_biturbo_token, +plotOneTest(df_scout_means_biturbo_token, + '../images/scout-biturbo-token-all-engines.png', suptitle="\nbiturbo token - all scout engines", suptitle_pos=1.05, subtitle="biturbo-token-eth1-mainnet-stateless-block-hexary-trie-keccak256-multiproof\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-biturbo-token-all-engines.png', bbox_inches='tight') - # In[ ]: @@ -718,17 +724,16 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[31]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_fast_biturbo_means, +plotScoutStackedTest(df_scout_fast_biturbo_means, + '../images/scout-biturbo-token-compilers-vs-interpreters.png', suptitle="\nbiturbo token - fast scout engines - wasm compilers vs interpreters (v8 vs wabt)", suptitle_pos=1.03, subtitle="biturbo-token-eth1-mainnet-stateless-block-hexary-trie-keccak256-multiproof\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-biturbo-token-compilers-vs-interpreters.png', bbox_inches='tight') - # In[ ]: @@ -750,7 +755,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= # ## Plot bignum benchmark: ecrecover-eth1-txns-websnark-secp256k1-verify-72-sigs -# In[32]: +# In[ ]: df_scout_ecrecover_websnark_secp256k1 = df_scout_data[df_scout_data['bench_name'] == 'ecrecover-eth1-txns-websnark-secp256k1-verify-72-sigs'] @@ -767,19 +772,17 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[33]: +# In[ ]: -fig_plt = plotOneTest(df_scout_means_ecrecover_websnark_secp256k1, +plotOneTest(df_scout_means_ecrecover_websnark_secp256k1, + '../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-all-engines.png', suptitle="websnark-secp256k1-sig-verify - all Scout engines", suptitle_pos=1.0, subtitle="ecrecover-eth1-txns-websnark-secp256k1-verify-72-sigs\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-all-engines.png', bbox_inches='tight') - - # In[ ]: @@ -792,18 +795,17 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[34]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_fast_ecrecover_means, +plotScoutStackedTest(df_scout_fast_ecrecover_means, + '../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-wabt-vs-v8.png', #suptitle="websnark-secp256k1-sig-verify - fast Scout engines - compilers (v8) vs interpreters (wabt)", suptitle="compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \n vs. \n interpreter engine (wabt) with bignum host funcs", suptitle_pos=1.07, subtitle="ecrecover-eth1-txns-websnark-secp256k1-verify-72-sigs\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-ecrecover-websnark-secp256k1-verify-72-sigs-wabt-vs-v8.png', bbox_inches='tight') - # In[ ]: @@ -843,7 +845,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[35]: +# In[ ]: df_scout_ecpairing_zkrollup_bn128_pairings = df_scout_data[df_scout_data['bench_name'] == 'ecpairing-zkrollup-websnark-bn128-two-pairings'] @@ -860,27 +862,26 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[36]: +# In[ ]: -fig_plt = plotOneTest(df_scout_means_ecpairing_zkrollup, +plotOneTest(df_scout_means_ecpairing_zkrollup, + '../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-all-engines.png', suptitle="websnark-bn128-pairings - all Scout engines", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-all-engines.png', bbox_inches='tight') - -# In[37]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_fast_means_ecpairing_zkrollup, +plotScoutStackedTest(df_scout_fast_means_ecpairing_zkrollup, + '../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-v8.png', suptitle="compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \n vs. \n interpreter engine (wabt) with bignum host funcs", suptitle_pos=1.07, subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-ecpairing-zkrollup-websnark-bn128-two-pairings-v8.png', bbox_inches='tight') # In[ ]: @@ -897,7 +898,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= # ## start with rust bn128 pairings, compare to native, and compare interpreters to compilers -# In[38]: +# In[ ]: df_scout_rolluprs_bn128_pairings = df_scout_data[df_scout_data['bench_name'] == 'ecpairing-zkrollup-rust-wasm-bn128-two-pairings'] @@ -910,17 +911,16 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= #df_scout_fast_means_rolluprs = df_scout_fast_rolluprs.groupby(['engine']).mean() -# In[39]: +# In[ ]: -fig_plt = plotOneTest(df_scout_means_rolluprs, +plotOneTest(df_scout_means_rolluprs, + '../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-all-engines.png', suptitle="rollup.rs-bn128-pairings - all Scout engines", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-all-engines.png', bbox_inches='tight') - # In[ ]: @@ -962,7 +962,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[40]: +# In[ ]: df_scout_rolluprs_bn128_pairings = df_scout_data[df_scout_data['bench_name'].isin( @@ -989,15 +989,15 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[41]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_fast_means_rolluprs, +plotScoutStackedTest(df_scout_fast_means_rolluprs, + '../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-v8.png', suptitle="compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \n vs. \n interpreter engine (wabt) with bignum host funcs", suptitle_pos=1.07, subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-ecpairing-zkrollup-rust-wasm-bn128-two-pairings-v8.png', bbox_inches='tight') # In[ ]: @@ -1038,7 +1038,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[42]: +# In[ ]: df_scout_rust_vs_websnark = df_scout_data[ @@ -1049,13 +1049,13 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= ].copy() -# In[43]: +# In[ ]: #df_scout_rust_vs_websnark -# In[44]: +# In[ ]: #df_scout_rust_vs_websnark.replace('ecpairing-zkrollup-rust-wasm-bn128-two-pairings', 'rust-wasm-bn128-two-pairings', inplace=True) @@ -1066,7 +1066,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[45]: +# In[ ]: df_scout_rust_vs_websnark = df_scout_rust_vs_websnark[df_scout_rust_vs_websnark['engine'].isin( @@ -1074,7 +1074,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= )].copy() -# In[46]: +# In[ ]: #df_scout_rust_vs_websnark @@ -1092,16 +1092,17 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[47]: +# In[ ]: # {'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'} -# In[48]: +# In[ ]: -fig_plt = plotOneTestGrouped(df_scout_rust_vs_websnark, +plotOneTestGrouped(df_scout_rust_vs_websnark, + '../images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png', title="websnark vs rust - zkrollup bn128 pairings (websnark/bn128 vs rollup.rs)", test_title="", group_order=['websnark-wasm', 'rust-wasm'], @@ -1109,10 +1110,10 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= colors=['tab:blue', 'tab:orange']) -# In[49]: +# In[ ]: + -fig_plt.savefig('../images/websnark-vs-rust-wasm-zkrollup-bn128-pairings.png', bbox_inches='tight') # In[ ]: @@ -1133,7 +1134,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[50]: +# In[ ]: df_rolluprs_native = df_scout_data[df_scout_data['bench_name'] == 'ecpairing-zkrollup-rust-native-bn128-two-pairings'] @@ -1151,19 +1152,18 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[51]: +# In[ ]: -fig_plt = plotOneTestGrouped(df_scout_rust_vs_websnark_fast_vs_native, +plotOneTestGrouped(df_scout_rust_vs_websnark_fast_vs_native, + '../images/websnark-vs-rust-wasm-native-zkrollup-bn128-pairings', title="websnark vs rust - zkrollup bn128 pairings (websnark/bn128 vs rollup.rs)", test_title="", sort_by=["rust-native", "rust-wasm", "websnark-wasm"], colors=['tab:green', 'tab:blue', 'tab:orange'], group_order=["rust-native", "websnark-wasm", "rust-wasm"]) -fig_plt.savefig('../images/websnark-vs-rust-wasm-native-zkrollup-bn128-pairings', bbox_inches='tight') - # ### TODO: adjust bar size and placement? @@ -1205,7 +1205,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[52]: +# In[ ]: # print out the engine names @@ -1234,7 +1234,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[53]: +# In[ ]: df_websnark_vs_native = df_scout_data[df_scout_data['bench_name'] == 'ecpairing-zkrollup-websnark-bn128-two-pairings'].copy() @@ -1249,23 +1249,22 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= df_websnark_vs_native_means = df_websnark_vs_native.groupby(['engine']).mean() -# In[54]: +# In[ ]: #df_websnark_vs_native_means -# In[55]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_websnark_vs_native_means, +plotScoutStackedTest(df_websnark_vs_native_means, + '../images/websnark-vs-native-bn128-two-pairings-v8.png', suptitle="compiler engines - optimizing (v8-turbofan) and single-pass (v8-liftoff) \n vs. \n interpreter engine (wabt) with bignum host funcs", suptitle_pos=1.07, subtitle="bn128-two-pairings - websnark vs rust-native\n", subtitle_size='xx-large') -fig_plt.savefig('../images/websnark-vs-native-bn128-two-pairings-v8.png', bbox_inches='tight') - # In[ ]: @@ -1293,7 +1292,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= # # Try Seaborn with error bars -# In[56]: +# In[ ]: import seaborn as sns @@ -1305,19 +1304,21 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[57]: +# In[ ]: df_websnark_vs_native['time'] = df_websnark_vs_native['exec_time'] + df_websnark_vs_native['parse_time'] -# In[58]: +# In[ ]: f = plt.figure(figsize=(14,8)) ax = sns.barplot(x='engine', y='time', data=df_websnark_vs_native) +plt.close('all') + # In[ ]: @@ -1331,13 +1332,15 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[59]: +# In[ ]: f = plt.figure(figsize=(14,8)) ax = sns.barplot(x='engine', y='exec_time', hue='bench_name', data=df_scout_rust_vs_websnark) +plt.close('all') + # In[ ]: @@ -1371,7 +1374,7 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[60]: +# In[ ]: df_scout_daiquiri_zkmixer = df_scout_data[df_scout_data['bench_name'] == 'daiquiri-zkmixer-websnark-bn128-groth16-four-pairings-and-mimc'] @@ -1388,29 +1391,27 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= -# In[61]: +# In[ ]: plotOneTest(df_scout_means_daiquiri_zkmixer, + '../images/scout-daiquiri-all-engines.png', suptitle="daiquiri-zkmixer - all Scout engines", suptitle_pos=1.02, subtitle="daiquiri-zkmixer-websnark-bn128-groth16-four-pairings-and-mimc\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-daiquiri-all-engines.png', bbox_inches='tight') - -# In[62]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_fast_means_daiquiri_zkmixer, +plotScoutStackedTest(df_scout_fast_means_daiquiri_zkmixer, + '../images/scout-daiquiri-v8-vs-wabt.png', suptitle="wasm compilers - optimizing (v8-turbofan) and single-pass (v8-liftoff) \n vs. \n wasm interpreter (wabt) with bignum host funcs", suptitle_pos=1.07, subtitle="daiquiri-zkmixer-websnark-bn128-groth16-four-pairings-and-mimc\n", subtitle_size='xx-large') -fig_plt.savefig('../images/scout-daiquiri-v8-vs-wabt.png', bbox_inches='tight') - # In[ ]: @@ -1444,19 +1445,19 @@ def plotScoutStackedTest(df_data, suptitle="title", suptitle_pos=1.00, subtitle= # ## Import geth precompile results -# In[63]: +# In[ ]: df_geth_precompiles = read_results(join(CSV_RESULT_DIR, GETH_PRECOMPILE_RESULT_FILE)) -# In[64]: +# In[ ]: #df_geth_precompiles -# In[65]: +# In[ ]: def splitName(test_name): @@ -1464,25 +1465,25 @@ def splitName(test_name): return (test_name[0:ix], test_name[ix+1:]) -# In[66]: +# In[ ]: df_geth_precompiles['precompile_name'], df_geth_precompiles['input_name'] = zip(*df_geth_precompiles.apply(lambda row: splitName(row['test_name']), axis=1)) -# In[67]: +# In[ ]: df_geth_precompiles = df_geth_precompiles[['precompile_name', 'input_name', 'gas', 'time']] -# In[68]: +# In[ ]: df_geth_native_bn128pairing = df_geth_precompiles[df_geth_precompiles["input_name"] == "two_point_match_rollup_input"].copy() -# In[69]: +# In[ ]: df_geth_native_bn128pairing @@ -1508,13 +1509,13 @@ def splitName(test_name): # ## Import standalone wasm results -# In[70]: +# In[ ]: df_wasm = read_results(join(CSV_RESULT_DIR, STANDALONE_WASM_RESULT_FILE)) -# In[71]: +# In[ ]: df_wasm @@ -1528,13 +1529,13 @@ def splitName(test_name): # ## Import native results -# In[72]: +# In[ ]: df_native_raw = read_results(join(CSV_RESULT_DIR, NATIVE_RESULT_FILE)) -# In[73]: +# In[ ]: native_results = {} @@ -1555,7 +1556,7 @@ def splitName(test_name): df_native['engine'] = 'rust-native' -# In[74]: +# In[ ]: df_native @@ -1581,7 +1582,7 @@ def splitName(test_name): # ### sorted lists of test names for plotting inputs in order -# In[75]: +# In[ ]: blake2b_test_names = [name for name in df_wasm['test_name'].unique().tolist() if 'blake2b' in name] @@ -1590,7 +1591,7 @@ def splitName(test_name): blake2b_test_names_desc.reverse() -# In[76]: +# In[ ]: sha1_test_names = [name for name in df_wasm['test_name'].unique().tolist() if 'sha1' in name] @@ -1599,7 +1600,7 @@ def splitName(test_name): sha1_test_names_desc.reverse() -# In[77]: +# In[ ]: @@ -1616,7 +1617,7 @@ def splitName(test_name): bn128_pairing_test_names_desc = ['bn128_pairing-ten_point_match_1', 'bn128_pairing-two_point_match_2', 'bn128_pairing-one_point'] -# In[78]: +# In[ ]: bls12_test_names = ['bls12-381-aggreg-32-pubkeys-verify-sig', 'bls12-381-aggreg-64-pubkeys-verify-sig', 'bls12-381-aggreg-128-pubkeys-verify-sig'] @@ -1624,7 +1625,7 @@ def splitName(test_name): bls12_test_names_desc.reverse() -# In[79]: +# In[ ]: modexp_test_names = [name for name in df_wasm['test_name'].unique().tolist() if 'modexp' in name] @@ -1633,7 +1634,7 @@ def splitName(test_name): modexp_test_names_desc.reverse() -# In[80]: +# In[ ]: all_tests = sha1_test_names + blake2b_test_names + modexp_test_names + ['ed25519-verify-ten-inputs'] + bls12_test_names + bn128_add_test_names + bn128_mul_test_names + bn128_pairing_test_names @@ -1653,7 +1654,7 @@ def splitName(test_name): # ### Prepare interpreter dataframe -# In[81]: +# In[ ]: all_interp_test_names = [] @@ -1679,7 +1680,7 @@ def splitName(test_name): #df_interp -# In[82]: +# In[ ]: df_wasm['test_name'].unique().tolist() @@ -1717,10 +1718,10 @@ def splitName(test_name): # ## Interpreter engines compared -# In[83]: +# In[ ]: -def plotInterpThreeTests(df_testdata, three_names, title="Title", filter_engines=None): +def plotInterpThreeTests(df_testdata, three_names, filepath, title="Title", filter_engines=None): if filter_engines is not None: df_testdata = filterDfEngines(df_testdata.reset_index(), filter_engines) df_testdata.set_index('engine', inplace=True) @@ -1755,7 +1756,8 @@ def plotInterpThreeTests(df_testdata, three_names, title="Title", filter_engines ax1[0].set(ylabel='milliseconds') f.suptitle(title, fontsize=16, y=0.98) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') # In[ ]: @@ -1764,11 +1766,10 @@ def plotInterpThreeTests(df_testdata, three_names, title="Title", filter_engines -# In[84]: +# In[ ]: -plt_fig = plotInterpThreeTests(df_interp, blake2b_test_names, title="wasm interpreters compared - blake2b") -plt_fig.savefig('../images/wasm-interp-blake2b.png', bbox_inches='tight') +plotInterpThreeTests(df_interp, blake2b_test_names, '../images/wasm-interp-blake2b.png', title="wasm interpreters compared - blake2b") # In[ ]: @@ -1797,10 +1798,10 @@ def plotInterpThreeTests(df_testdata, three_names, title="Title", filter_engines # ### Interpreters - Execution time -# In[85]: +# In[ ]: -def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engines=None): +def plotThreeTestsExecTime(df_testdata, three_names, filepath, title="Title", filter_engines=None): if filter_engines is not None: df_testdata = filterDfEngines(df_testdata.reset_index(), filter_engines) df_testdata.set_index('engine', inplace=True) @@ -1835,14 +1836,14 @@ def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engin ax1[0].set(ylabel='milliseconds') f.suptitle(title, fontsize=16, y=0.98) - return f + f.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[86]: +# In[ ]: -plt_fig = plotThreeTestsExecTime(df_interp, blake2b_test_names, title="wasm interpreters compared - blake2b") -plt_fig.savefig('../images/wasm-interp-blake2b-exec.png', bbox_inches='tight') +plotThreeTestsExecTime(df_interp, blake2b_test_names, '../images/wasm-interp-blake2b-exec.png', title="wasm interpreters compared - blake2b") # In[ ]: @@ -1865,34 +1866,34 @@ def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engin # ## Chart of only the fast interpreters -# In[87]: +# In[ ]: -plt_fig = plotInterpThreeTests(df_interp, +plotInterpThreeTests(df_interp, blake2b_test_names, + '../images/wasm-interp-blake2b-fast.png', title="wasm interpreters compared - blake2b", filter_engines=["life", "wagon", "v8-interpreter"]) -plt_fig.savefig('../images/wasm-interp-blake2b-fast.png', bbox_inches='tight') -# In[88]: +# In[ ]: -plt_fig = plotInterpThreeTests(df_interp, +plotInterpThreeTests(df_interp, modexp_test_names, + '../images/wasm-interp-modexp.png', title="wasm interpreters compared - modexp", filter_engines=["life", "wagon", "v8-interpreter"]) -plt_fig.savefig('../images/wasm-interp-modexp.png', bbox_inches='tight') -# In[89]: +# In[ ]: -plt_fig = plotInterpThreeTests(df_interp, +plotInterpThreeTests(df_interp, bn128_add_test_names, + '../images/wasm-interp-bn128-add.png', title="wasm interpreters compared - bn128_add", filter_engines=["life", "wagon", "v8-interpreter"]) -plt_fig.savefig('../images/wasm-interp-bn128-add.png', bbox_inches='tight') # In[ ]: @@ -1901,24 +1902,24 @@ def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engin -# In[90]: +# In[ ]: -plt_fig = plotThreeTestsExecTime(df_interp, +plotThreeTestsExecTime(df_interp, blake2b_test_names, + '../images/wasm-interp-blake2b-life-wagon-v8.png', title="wasm interpreters compared - blake2b", filter_engines=["life", "wagon", "v8-interpreter"]) -plt_fig.savefig('../images/wasm-interp-blake2b-life-wagon-v8.png', bbox_inches='tight') -# In[91]: +# In[ ]: -plt_fig = plotThreeTestsExecTime(df_interp, +plotThreeTestsExecTime(df_interp, bls12_test_names, + '../images/wasm-interp-bls12.png', title="wasm interpreters compared - bls12", filter_engines=["life", "wagon", "v8-interpreter"]) -plt_fig.savefig('../images/wasm-interp-bls12.png', bbox_inches='tight') # In[ ]: @@ -1953,7 +1954,7 @@ def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engin # ## Compiler Results -# In[92]: +# In[ ]: compiler_results_for_df = [] @@ -1966,7 +1967,7 @@ def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engin -# In[93]: +# In[ ]: df_compiler = pd.DataFrame(compiler_results_for_df) @@ -1992,16 +1993,16 @@ def plotThreeTestsExecTime(df_testdata, three_names, title="Title", filter_engin # ## JIT bomb chart - guido-fuzzer-find-1 -# In[94]: +# In[ ]: #df_compiler -# In[95]: +# In[ ]: -def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): +def plotJitBomb(df_jit, filepath, title="jit bomb chart", log_scale=False): f = plt.figure(figsize=(14,8)) bombplot = sns.barplot(x='engine', y='value', hue='exec_or_compile', dodge=True, data=df_jit) @@ -2019,7 +2020,8 @@ def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): textcoords = 'offset points') f.suptitle(title, fontsize=18, y=0.95) - return f + f.savefig(filepath, bbox_inches='tight') + plt.close('all') # In[ ]: @@ -2034,13 +2036,13 @@ def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): -# In[96]: +# In[ ]: df_jitbomb_1 = df_compiler[df_compiler['test_name'] == 'guido-fuzzer-find-1'].copy() -# In[97]: +# In[ ]: df_jitbomb_1.drop(['elapsed_time'], axis=1, inplace=True) @@ -2048,24 +2050,26 @@ def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): df_jitbomb_1.reset_index(inplace=True) -# In[98]: +# In[ ]: df_jitbomb_1 = df_jitbomb_1.melt(id_vars=["engine", "test_name"], var_name="exec_or_compile") -# In[99]: +# In[ ]: -fig_plt = plotJitBomb(df_jitbomb_1, "JIT bomb guido-fuzzer-find-1") -fig_plt.savefig('../images/standalone-jitbomb-guido-fuzzer-find-1.png', bbox_inches='tight') +plotJitBomb(df_jitbomb_1, + '../images/standalone-jitbomb-guido-fuzzer-find-1.png', + "JIT bomb guido-fuzzer-find-1") -# In[100]: +# In[ ]: -fig_plt = plotJitBomb(df_jitbomb_1, "JIT bomb guido-fuzzer-find-1 - log scale", log_scale=True) -fig_plt.savefig('../images/standalone-jitbomb-guido-fuzzer-find-1-log-scale.png', bbox_inches='tight') +plotJitBomb(df_jitbomb_1, + '../images/standalone-jitbomb-guido-fuzzer-find-1-log-scale.png', + "JIT bomb guido-fuzzer-find-1 - log scale", log_scale=True) # In[ ]: @@ -2088,7 +2092,7 @@ def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): # ### guido-fuzzer-find-2 -# In[101]: +# In[ ]: df_jitbomb_2 = df_compiler[df_compiler['test_name'] == 'guido-fuzzer-find-2'].copy() @@ -2100,12 +2104,10 @@ def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): df_jitbomb_2 = df_jitbomb_2.melt(id_vars=["engine", "test_name"], var_name="exec_or_compile") -# In[102]: - +# In[ ]: -fig_plt = plotJitBomb(df_jitbomb_2, "JIT bomb guido-fuzzer-find-2 (log scale)", log_scale=True) -fig_plt.savefig('../images/standalone-jitbomb-guido-fuzzer-find-2-log-scale.png', bbox_inches='tight') +plotJitBomb(df_jitbomb_2, '../images/standalone-jitbomb-guido-fuzzer-find-2-log-scale.png', "JIT bomb guido-fuzzer-find-2 (log scale)", log_scale=True) # # TODO: mention v8-liftoff version here @@ -2151,10 +2153,10 @@ def plotJitBomb(df_jit, title="jit bomb chart", log_scale=False): # # *Note: Fix scale for v8-turbofan execution time* -# In[103]: +# In[ ]: -def plotCompilerStackedOneTest(df_benchdata, test_name): +def plotCompilerStackedOneTest(df_benchdata, filepath, test_name): plt.figure() df_1 = df_benchdata[df_benchdata['test_name'] == test_name] # for some reason, exec_time needs to come first for the stacked chart to display correctly @@ -2170,14 +2172,16 @@ def plotCompilerStackedOneTest(df_benchdata, test_name): plt.ylabel("seconds (log scale)") adjust_text_labels(labelBarHeights(ax, lower_y_bound=False)) ax.legend(labels=["execution time", "compile time"]) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[104]: +# In[ ]: -fig_plt = plotCompilerStackedOneTest(df_compiler, "blake2b-8415-bytes") -fig_plt.savefig('../images/standalone-blake2b-8415-bytes-compilers.png', bbox_inches='tight') +plotCompilerStackedOneTest(df_compiler, + '../images/standalone-blake2b-8415-bytes-compilers.png', + "blake2b-8415-bytes") # In[ ]: @@ -2224,7 +2228,7 @@ def plotCompilerStackedOneTest(df_benchdata, test_name): # ## Add rust-native to compiler engines chart -# In[105]: +# In[ ]: # merge df_native and df_compiler into one dataframe @@ -2248,11 +2252,12 @@ def plotCompilerStackedOneTest(df_benchdata, test_name): -# In[106]: +# In[ ]: -fig_plt = plotCompilerStackedOneTest(df_native_and_compile, "bls12-381-aggreg-128-pubkeys-verify-sig") -fig_plt.savefig('../images/standalone-bls12-381-aggreg-128-pubkeys-verify-sig-compilers-vs-native.png', bbox_inches='tight') +plotCompilerStackedOneTest(df_native_and_compile, + '../images/standalone-bls12-381-aggreg-128-pubkeys-verify-sig-compilers-vs-native.png', + "bls12-381-aggreg-128-pubkeys-verify-sig") # In[ ]: @@ -2287,7 +2292,7 @@ def plotCompilerStackedOneTest(df_benchdata, test_name): -# In[107]: +# In[ ]: # merge df_compiler and df_interp @@ -2303,7 +2308,7 @@ def plotCompilerStackedOneTest(df_benchdata, test_name): -# In[108]: +# In[ ]: def add_engine_ratio_col(df_two_engines, interp_engine, compiler_engine): @@ -2324,7 +2329,7 @@ def add_engine_ratio_col(df_two_engines, interp_engine, compiler_engine): return df_interp -# In[109]: +# In[ ]: df_wabt_v8liftoff = add_engine_ratio_col(df_interp_and_compile, "wabt", "v8-liftoff") @@ -2336,10 +2341,10 @@ def add_engine_ratio_col(df_two_engines, interp_engine, compiler_engine): -# In[110]: +# In[ ]: -def plotCompilerSpeedup(df_compiler_speedup, interp_name="interp", compiler_name="compiler"): +def plotCompilerSpeedup(df_compiler_speedup, filepath, interp_name="interp", compiler_name="compiler"): df_is = df_compiler_speedup.copy() plot_tests = df_is['test_name'].tolist() test_index = all_tests.copy() @@ -2368,14 +2373,16 @@ def plotCompilerSpeedup(df_compiler_speedup, interp_name="interp", compiler_name plt.legend(labels=["compiler engine is faster (ratio > 1x)", "compiler speedup \n (ratio: interp_exec_time/compiler_exec_time)"]) #f.suptitle(title, fontsize=16, y=0.95) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[111]: +# In[ ]: -plt_fig = plotCompilerSpeedup(df_wabt_v8liftoff, interp_name="wabt", compiler_name="v8-liftoff") -plt_fig.savefig('../images/standalone-wabt-vs-v8-liftoff-speedup.png', bbox_inches='tight') +plotCompilerSpeedup(df_wabt_v8liftoff, + '../images/standalone-wabt-vs-v8-liftoff-speedup.png', + interp_name="wabt", compiler_name="v8-liftoff") # In[ ]: @@ -2392,10 +2399,10 @@ def plotCompilerSpeedup(df_compiler_speedup, interp_name="interp", compiler_name # ## All precompiles compared (are interpreters feasible?) -# In[112]: +# In[ ]: -def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): +def plotInterpOneEngine(df_benchdata, filepath, engine, test_names, title=""): df_bench = df_benchdata.loc[engine][df_benchdata.loc[engine]['test_name'].isin(test_names)] df_bench.set_index('test_name', inplace=True) df_bench = df_bench.reindex(test_names) @@ -2408,14 +2415,18 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): plt.legend([handles[1], handles[0]], ['execution time (top bar/label)', 'startup time (bottom bar/label - bar not visible for times < 20.0ms)']) adjust_text_labels(labelBarHeights(ax)) plt.suptitle(title, fontsize=16, y=0.95) - return plt + plt.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[113]: +# In[ ]: -plt_fig = plotInterpOneEngine(df_interp, 'wasmi', all_tests, "Wasmi - all Precompiles (existing and proposed) compared") -plt_fig.savefig('../images/standalone-wasmi-all-precompiles.png', bbox_inches='tight') +plotInterpOneEngine(df_interp, + '../images/standalone-wasmi-all-precompiles.png', + 'wasmi', + all_tests, + "Wasmi - all Precompiles (existing and proposed) compared") # In[ ]: @@ -2424,11 +2435,14 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): -# In[114]: +# In[ ]: -plt_fig = plotInterpOneEngine(df_interp, 'wabt', all_tests, "Wabt - all Precompiles (existing and proposed) compared") -plt_fig.savefig('../images/standalone-wabt-all-precompiles.png', bbox_inches='tight') +plotInterpOneEngine(df_interp, + '../images/standalone-wabt-all-precompiles.png', + 'wabt', + all_tests, + "Wabt - all Precompiles (existing and proposed) compared") # In[ ]: @@ -2455,20 +2469,19 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): -# In[115]: +# In[ ]: -plt_fig = plotThreeTestsExecTime(df_interp, +plotThreeTestsExecTime(df_interp, bn128_pairing_test_names, + '../images/standalone-wasm-interp-bn128-pairings.png', title="wasm interpreters compared - bn128 pairings", filter_engines=["life", "wagon", "v8-interpreter"]) -plt_fig.savefig('../images/standalone-wasm-interp-bn128-pairings.png', bbox_inches='tight') # #### Are interpreter engines feasible for bn128 pairings? # TODO: highlight pairing two point match in interpreter engines # -# # In[ ]: @@ -2476,12 +2489,12 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): -# In[116]: - +# In[ ]: -fig_plt = plotCompilerStackedOneTest(df_native_and_compile, "bn128_pairing-two_point_match_2") -fig_plt.savefig('../images/standalone-rust-bn128-pairings-compiler-vs-native.png', bbox_inches='tight') +plotCompilerStackedOneTest(df_native_and_compile, + '../images/standalone-rust-bn128-pairings-compiler-vs-native.png', + "bn128_pairing-two_point_match_2") # In[ ]: @@ -2516,20 +2529,20 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): # ### add geth-native to df_scout_data for the rollup benchmark -# In[117]: +# In[ ]: df_geth_native_bn128pairing -# In[118]: +# In[ ]: df_geth_native_bn128pairing.loc[:, 'engine'] = "go-native" df_geth_native_bn128pairing.loc[:, 'parse_time'] = 0 -# In[119]: +# In[ ]: df_geth_native_bn128pairing.rename(columns={'input_name':'bench_name','time':'exec_time'},inplace=True) @@ -2538,13 +2551,13 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): df_geth_native_bn128pairing = df_geth_native_bn128pairing[['engine', 'bench_name', 'parse_time', 'exec_time']] -# In[120]: +# In[ ]: df_geth_native_bn128pairing.loc[:,'bench_name'] = 'ecpairing-zkrollup-go-native-bn128-two-pairings' -# In[121]: +# In[ ]: df_geth_native_bn128pairing @@ -2564,7 +2577,7 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): # ## list engine names -# In[122]: +# In[ ]: @@ -2591,7 +2604,7 @@ def plotInterpOneEngine(df_benchdata, engine, test_names, title=""): # ## function to prepare dataframe for rollup.rs and websnark plots # -# In[123]: +# In[ ]: def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only_include_engines=None, rename_engines=None): @@ -2624,7 +2637,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[124]: +# In[ ]: include_bench_names = ['ecpairing-zkrollup-rust-wasm-bn128-two-pairings', 'ecpairing-zkrollup-rust-native-bn128-two-pairings'] @@ -2639,18 +2652,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_rolluprs_bignums_vs_nobignums = df_scout_rolluprs_bignums_vs_nobignums.groupby(['engine']).mean() -# In[125]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_rolluprs_bignums_vs_nobignums, +plotOneTestColoredTicks(df_scout_rolluprs_bignums_vs_nobignums, + '../images/bignums-rollup-rs-bn128-pairings-with-vs-without-bignums.png', suptitle="rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-with-bignums"]) -fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-with-vs-without-bignums.png', bbox_inches='tight') - # In[ ]: @@ -2691,7 +2703,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[126]: +# In[ ]: include_bench_names = ['ecpairing-zkrollup-rust-wasm-bn128-two-pairings', 'ecpairing-zkrollup-rust-native-bn128-two-pairings'] @@ -2708,18 +2720,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_rolluprs_bignums = df_scout_rolluprs_bignums.groupby(['engine']).mean() -# In[127]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_rolluprs_bignums, +plotOneTestColoredTicks(df_scout_rolluprs_bignums, + '../images/bignums-rollup-rs-bn128-pairings-wabt-with-bignums.png', suptitle="rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-with-bignums"]) -fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-wabt-with-bignums.png', bbox_inches='tight') - # In[ ]: @@ -2741,7 +2752,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[128]: +# In[ ]: include_bench_names = ['ecpairing-zkrollup-rust-wasm-bn128-two-pairings', 'ecpairing-zkrollup-rust-native-bn128-two-pairings'] @@ -2768,18 +2779,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[129]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_rollup_rustwasm_superops, +plotOneTestColoredTicks(df_scout_rollup_rustwasm_superops, + '../images/bignums-rollup-rs-bn128-pairings-superops.png', suptitle="rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-bignums-superops"]) -fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-superops.png', bbox_inches='tight') - # In[ ]: @@ -2801,7 +2811,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[130]: +# In[ ]: include_bench_names = ['ecpairing-zkrollup-rust-wasm-bn128-two-pairings', 'ecpairing-zkrollup-rust-native-bn128-two-pairings'] @@ -2824,18 +2834,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_rolluprs_all_combos = df_scout_rolluprs_all_combos.groupby(['engine']).mean() -# In[131]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_rolluprs_all_combos, +plotOneTestColoredTicks(df_scout_rolluprs_all_combos, + '../images/bignums-rollup-rs-bn128-pairings-all-combos.png', suptitle="rollup.rs-bn128-pairings - fast Scout engines (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-bignums-superops-fasthost-fastmont"]) -fig_plt.savefig('../images/bignums-rollup-rs-bn128-pairings-all-combos.png', bbox_inches='tight') - # In[ ]: @@ -2857,7 +2866,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[132]: +# In[ ]: include_bench_names = ['ecpairing-zkrollup-rust-wasm-bn128-two-pairings', 'ecpairing-zkrollup-websnark-bn128-two-pairings'] @@ -2877,10 +2886,11 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only ]) -# In[133]: +# In[ ]: -fig_plt = plotOneTestGrouped(df_scout_rust_vs_websnark, +plotOneTestGrouped(df_scout_rust_vs_websnark, + '../images/bignums-zkrollup-rust-vs-websnark-bn128-pairings.png', title="websnark vs rust - zkrollup bn128 pairings (websnark/bn128 vs rollup.rs)", test_title="", group_order=['websnark-wasm', 'rust-wasm'], @@ -2888,9 +2898,6 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only colors=['tab:orange', 'tab:blue']) -fig_plt.savefig('../images/bignums-zkrollup-rust-vs-websnark-bn128-pairings.png', bbox_inches='tight') - - # In[ ]: @@ -2905,7 +2912,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only # ### drop rust-wasm, just plot websnark-wasm on different engines -# In[134]: +# In[ ]: include_engines_list = ['go-native', 'rust-native', 'v8-liftoff', 'v8-turbofan', @@ -2927,18 +2934,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_means_websnark = df_scout_websnark.groupby(['engine']).mean() -# In[135]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_means_websnark, +plotOneTestColoredTicks(df_scout_means_websnark, + '../images/bignums-websnark-bn128-pairings-superops.png', suptitle="websnark-bn128-pairings - engines compared (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-websnaark-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-bignums-superops"]) -fig_plt.savefig('../images/bignums-websnark-bn128-pairings-superops.png', bbox_inches='tight') - # In[ ]: @@ -2967,7 +2973,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only # ### websnark-wasm optimization: "fast-host" # -# In[136]: +# In[ ]: include_engines_list = ['go-native', 'rust-native', 'v8-liftoff', 'v8-turbofan', @@ -2991,18 +2997,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_websnark_fasthost = df_scout_websnark_fasthost.groupby(['engine']).mean() -# In[137]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_websnark_fasthost, +plotOneTestColoredTicks(df_scout_websnark_fasthost, + '../images/bignums-websnark-bn128-pairings-fasthost.png', suptitle="websnark-bn128-pairings - engines compared (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-bignums-superops-fasthost"]) -fig_plt.savefig('../images/bignums-websnark-bn128-pairings-fasthost.png', bbox_inches='tight') - # In[ ]: @@ -3018,7 +3023,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only -# In[138]: +# In[ ]: include_engines_list = ['go-native', 'rust-native', 'v8-liftoff', 'v8-turbofan', 'wabt-bignums-slowhost-slowmont', @@ -3042,18 +3047,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_websnark_fastmont = df_scout_websnark_fastmont.groupby(['engine']).mean() -# In[139]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_websnark_fastmont, +plotOneTestColoredTicks(df_scout_websnark_fastmont, + '../images/bignums-websnark-bn128-pairings-fastmont.png', suptitle="websnark-bn128-pairings - engines compared (v8-liftoff and wabt-with-bignums)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-websnaark-bn128-two-pairings\n", subtitle_size='xx-large', highlight_ticks=["wabt-bignums-superops-fasthost-fastmont"]) -fig_plt.savefig('../images/bignums-websnark-bn128-pairings-fastmont.png', bbox_inches='tight') - # In[ ]: @@ -3063,17 +3067,16 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only # ### websnark-wasm: Show startup time and execution time, for interleaved montgomery and other optimizations -# In[140]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_websnark_fastmont, +plotScoutStackedTest(df_scout_websnark_fastmont, + '../images/bignums-websnark-bn128-pairings-startup-and-execution.png', suptitle="wasm compilers - optimizing (v8-turbofan) and single-pass (v8-liftoff) \n vs. \n wasm interpreter (wabt) with bignum host funcs", suptitle_pos=1.07, subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", subtitle_size='xx-large') -fig_plt.savefig('../images/bignums-websnark-bn128-pairings-startup-and-execution.png', bbox_inches='tight') - # In[ ]: @@ -3096,7 +3099,7 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only # ## plot v8 with bignums versus without # -# In[141]: +# In[ ]: include_engines_list = ['go-native', 'rust-native', 'v8-liftoff', 'v8-turbofan', @@ -3121,16 +3124,17 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only df_scout_v8_with_hostfuncs = df_scout_v8_with_hostfuncs.groupby(['engine']).mean() -# In[142]: +# In[ ]: plt.style.use('ggplot') -# In[143]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_v8_with_hostfuncs, +plotOneTestColoredTicks(df_scout_v8_with_hostfuncs, + '../images/bignums-websnark-bn128-pairings-v8-with-bignums.png', suptitle="websnark-bn128-pairings - engines compared (v8 without host funcs, v8 with host funcs)", suptitle_pos=1.02, subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", @@ -3138,10 +3142,6 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only highlight_ticks=["v8-liftoff-with-bignums", "v8-turbofan-with-bignums"]) - -fig_plt.savefig('../images/bignums-websnark-bn128-pairings-v8-with-bignums.png', bbox_inches='tight') - - # In[ ]: @@ -3156,10 +3156,10 @@ def prepDfForRollupPlot(df_scout_data, df_geth_native, include_bench_names, only # ## plot function for EVM vs Wasm -# In[144]: +# In[ ]: -def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False): +def plotEVMvsWasm(df_evm_vs_wasm, filepath, subtitle, colors=['tab:blue', 'tab:orange'], dodge=False): f = plt.figure(figsize=(14,8)) #sns.set() sns.reset_defaults() # use default colors, orange and blue @@ -3186,8 +3186,9 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False splot.set_xticklabels(splot.get_xticklabels(), size = 14) plt.legend(fontsize='x-large', title_fontsize='40') - #f.suptitle("title", fontsize=18, y=1.02) - return f + f.suptitle(subtitle, fontsize=18, y=1.02) + f.savefig(filepath, bbox_inches='tight') + plt.close('all') # In[ ]: @@ -3205,25 +3206,25 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ## EVM vs wasm shootout: bn128mul (Weierstrudel vs bn128mul.rust.wasm) # -# In[145]: +# In[ ]: df_evm_raw -# In[146]: +# In[ ]: df_evm_raw.columns = df_evm_raw.columns.str.replace(' ','') -# In[147]: +# In[ ]: df_evm_raw.keys() -# In[148]: +# In[ ]: df_evm_raw[df_evm_raw['test_name'] == "bn128_mul_weierstrudel-chfast2"] @@ -3235,7 +3236,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[149]: +# In[ ]: # get wasm data for bn128_mul-chfast2 @@ -3248,7 +3249,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_wasm_bn128mul.replace('bn128_mul-chfast2', 'bn128mul.rust.wasm', inplace=True) -# In[150]: +# In[ ]: # get evm data @@ -3261,7 +3262,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm_bn128mul.replace('bn128_mul_weierstrudel-chfast2', 'bn128mul.weierstrudel.evm', inplace=True) -# In[151]: +# In[ ]: df_evm_vs_wasm_bn128mul = df_evm_bn128mul.append(df_wasm_bn128mul, sort=False).copy() @@ -3277,7 +3278,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm_vs_wasm_bn128mul = df_evm_vs_wasm_bn128mul.sort_values('time') -# In[152]: +# In[ ]: #df_evm_vs_wasm_bn128mul[df_evm_vs_wasm_bn128mul['bench_name'] == ''] @@ -3291,14 +3292,13 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[153]: - +# In[ ]: -f = plotEVMvsWasm(df_evm_vs_wasm_bn128mul) -#f.suptitle("EVM vs Wasm interpreters: bn128mul aka ECMUL \n\n bn128mul (Rust compiled to Wasm) vs Weierstrudel (Huff compiled to EVM)", fontsize=18, y=1.02) -f.suptitle("EVM vs Wasm interpreters: ECMUL aka bn128mul \n\n Weierstrudel.huff (Huff compiled to EVM) vs bn128mul.rs (Rust compiled to Wasm)", fontsize=18, y=1.02) -f.savefig('../images/evm-vs-wasm-bn128mul-huff-rust.png', bbox_inches='tight') +plotEVMvsWasm(df_evm_vs_wasm_bn128mul, + '../images/evm-vs-wasm-bn128mul-huff-rust.png', + "EVM vs Wasm interpreters: ECMUL aka bn128mul \n\n Weierstrudel.huff (Huff compiled to EVM) vs bn128mul.rs (Rust compiled to Wasm)" + ) # In[ ]: @@ -3327,7 +3327,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[154]: +# In[ ]: df_wasm_mul256 = df_interp[df_interp['test_name'] == "mul256-gcolvin-drag-race"].copy() @@ -3342,7 +3342,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_wasm_mul256.replace('mul256-gcolvin-drag-race', 'mul256.rust.wasm', inplace=True) -# In[155]: +# In[ ]: df_evm_mul256 = df_evm_raw[df_evm_raw['test_name'] == "mul256-gcolvin-drag-race"].copy() @@ -3355,7 +3355,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm_mul256.replace('mul256-gcolvin-drag-race', 'mul256.sol.evm', inplace=True) -# In[156]: +# In[ ]: df_evm_vs_wasm_mul256 = df_evm_mul256.append(df_wasm_mul256, sort=False).copy() @@ -3369,20 +3369,20 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm_vs_wasm_mul256 = df_evm_vs_wasm_mul256.sort_values('time') -# In[157]: +# In[ ]: df_evm_vs_wasm_mul256.replace('mul256.sol.evm', 'EVM (Solidity)', inplace=True) df_evm_vs_wasm_mul256.replace('mul256.rust.wasm', 'Wasm (Rust)', inplace=True) -# In[158]: - +# In[ ]: -f = plotEVMvsWasm(df_evm_vs_wasm_mul256) -f.suptitle("EVM vs Wasm interpreters: mul256-gcolvin-drag-race (Solidity to EVM) and (Rust to Wasm)", fontsize=18, y=0.95) -f.savefig('../images/evm-vs-wasm-mul256-sol-rust.png', bbox_inches='tight') +plotEVMvsWasm(df_evm_vs_wasm_mul256, + '../images/evm-vs-wasm-mul256-sol-rust.png', + "EVM vs Wasm interpreters: mul256-gcolvin-drag-race (Solidity to EVM) and (Rust to Wasm)" + ) # In[ ]: @@ -3399,7 +3399,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ## EVM vs wasm shootout: blake2b -# In[159]: +# In[ ]: df_evm_blake2b = df_evm_raw[df_evm_raw['test_name'].isin(['blake2b-8415-bytes', 'blake2b_huff-8415-bytes'])].copy() @@ -3413,7 +3413,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm_blake2b.replace('blake2b_huff-8415-bytes', 'blake2b-8kb.huff.evm', inplace=True) -# In[160]: +# In[ ]: df_wasm_blake2b = df_interp[df_interp['test_name'] == "blake2b-8415-bytes"].copy() @@ -3426,7 +3426,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_wasm_blake2b.replace('blake2b-8415-bytes', 'blake2b-8kb.rust.wasm', inplace=True) -# In[161]: +# In[ ]: df_evm_vs_wasm_blake2b = df_evm_blake2b.append(df_wasm_blake2b, sort=False).copy() @@ -3439,7 +3439,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False )].copy() -# In[162]: +# In[ ]: df_evm_vs_wasm_blake2b_sorted = df_evm_vs_wasm_blake2b.sort_values('time') @@ -3447,7 +3447,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ### blake2b.huff.evm vs blake2b.rust.wasm -# In[163]: +# In[ ]: df_blake2b_huff_vs_wasm = df_evm_vs_wasm_blake2b[df_evm_vs_wasm_blake2b['bench_name'].isin( @@ -3455,26 +3455,26 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False )].copy() -# In[164]: +# In[ ]: df_blake2b_huff_vs_wasm = df_blake2b_huff_vs_wasm.sort_values('time') -# In[165]: +# In[ ]: df_blake2b_huff_vs_wasm.replace('blake2b-8kb.huff.evm', 'EVM (Huff)', inplace=True) df_blake2b_huff_vs_wasm.replace('blake2b-8kb.rust.wasm', 'Wasm (Rust)', inplace=True) -# In[166]: - +# In[ ]: -f = plotEVMvsWasm(df_blake2b_huff_vs_wasm, colors=['tab:orange', 'tab:blue']) -f.suptitle("EVM vs Wasm: BLAKE2b-8415-bytes (Huff to EVM) and (Rust to wasm)", fontsize=18, y=0.95) -f.savefig('../images/evm-vs-wasm-blake2b-huff-rust.png', bbox_inches='tight') +plotEVMvsWasm(df_blake2b_huff_vs_wasm, + '../images/evm-vs-wasm-blake2b-huff-rust.png', + "EVM vs Wasm: BLAKE2b-8415-bytes (Huff to EVM) and (Rust to wasm)", + colors=['tab:orange', 'tab:blue']) # In[ ]: @@ -3486,7 +3486,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ### blake2b.sol.evm vs blake2b.huff.evm # -# In[167]: +# In[ ]: df_blake2b_sol_vs_huff = df_evm_vs_wasm_blake2b[df_evm_vs_wasm_blake2b['bench_name'].isin( @@ -3496,26 +3496,26 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_blake2b_sol_vs_huff = df_blake2b_sol_vs_huff.sort_values('time') -# In[168]: +# In[ ]: df_blake2b_sol_vs_huff -# In[169]: +# In[ ]: df_blake2b_sol_vs_huff.replace('blake2b-8kb.huff.evm', 'EVM (Huff)', inplace=True) df_blake2b_sol_vs_huff.replace('blake2b-8kb.sol.evm', 'EVM (Solidity)', inplace=True) -# In[170]: - +# In[ ]: -f = plotEVMvsWasm(df_blake2b_sol_vs_huff, colors=['tab:blue', 'tab:olive'], dodge=True) -f.suptitle("EVM implementations of BLAKE2b: Solidity vs Huff", fontsize=18, y=0.95) -f.savefig('../images/evm-vs-wasm-blake2b-sol-huff.png', bbox_inches='tight') +plotEVMvsWasm(df_blake2b_sol_vs_huff, + '../images/evm-vs-wasm-blake2b-sol-huff.png', + "EVM implementations of BLAKE2b: Solidity vs Huff", + colors=['tab:blue', 'tab:olive'], dodge=True) # In[ ]: @@ -3538,7 +3538,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ## plot blake2b.sol.evm against blake2b.rust.wasm -# In[171]: +# In[ ]: df_blake2b_sol_vs_rust = df_evm_vs_wasm_blake2b[df_evm_vs_wasm_blake2b['bench_name'].isin( @@ -3554,20 +3554,21 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[172]: +# In[ ]: df_blake2b_sol_vs_rust.replace('blake2b-8kb.rust.wasm', 'Wasm (Rust)', inplace=True) df_blake2b_sol_vs_rust.replace('blake2b-8kb.sol.evm', 'EVM (Solidity)', inplace=True) -# In[173]: - +# In[ ]: -f = plotEVMvsWasm(df_blake2b_sol_vs_rust, colors=['tab:orange', 'tab:olive'], dodge=False) -f.suptitle("EVM vs Wasm interpreters: BLAKE2b-8415-bytes (Solidity-evm vs Rust-wasm)", fontsize=18, y=0.95) -f.savefig('../images/evm-vs-wasm-blake2b-sol-rust.png', bbox_inches='tight') +plotEVMvsWasm(df_blake2b_sol_vs_rust, + '../images/evm-vs-wasm-blake2b-sol-rust.png', + "EVM vs Wasm interpreters: BLAKE2b-8415-bytes (Solidity-evm vs Rust-wasm)", + colors=['tab:orange', 'tab:olive'], + dodge=False) # In[ ]: @@ -3584,7 +3585,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ## blake2b: solidity vs huff vs rust -# In[174]: +# In[ ]: df_blake2b_sol_huff_rust = df_evm_vs_wasm_blake2b[df_evm_vs_wasm_blake2b['bench_name'].isin( @@ -3594,7 +3595,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_blake2b_sol_huff_rust = df_blake2b_sol_huff_rust.sort_values('time') -# In[175]: +# In[ ]: df_blake2b_sol_huff_rust.replace('blake2b-8kb.rust.wasm', 'Wasm (Rust)', inplace=True) @@ -3602,7 +3603,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_blake2b_sol_huff_rust.replace('blake2b-8kb.huff.evm', 'EVM (Huff)', inplace=True) -# In[176]: +# In[ ]: f = plt.figure(figsize=(14,8)) @@ -3654,6 +3655,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False f.suptitle("EVM vs Wasm: BLAKE2b-8415-bytes \n\n Huff-evm vs Solidity-evm vs Rust-wasm", fontsize=18, y=1.02) f.savefig('../images/evm-vs-wasm-blake2b-huff-sol-rust.png', bbox_inches='tight') +plt.close('all') # In[ ]: @@ -3676,13 +3678,13 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[177]: +# In[ ]: df_scout_data[df_scout_data['bench_name'].str.contains('bls')] -# In[178]: +# In[ ]: include_engines_list = ['rust-native', 'v8-liftoff', 'v8-turbofan', @@ -3703,41 +3705,39 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_scout_bls12 = df_scout_bls12.groupby(['engine']).mean() -# In[179]: +# In[ ]: df_scout_bls12 -# In[180]: +# In[ ]: -fig_plt = plotOneTestColoredTicks(df_scout_bls12, +plotOneTestColoredTicks(df_scout_bls12, + '../images/bignums-bls12-pairings-rust-vs-wasm-total-time.png', suptitle="BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)", suptitle_pos=1.02, #subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", #subtitle_size='xx-large', highlight_ticks=["wabt-with-bignums"]) -fig_plt.savefig('../images/bignums-bls12-pairings-rust-vs-wasm-total-time.png', bbox_inches='tight') - -# In[181]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_bls12, +plotScoutStackedTest(df_scout_bls12, + '../images/bignums-bls12-pairings-rust-vs-wasm-exec-startup-time.png', suptitle="BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)", suptitle_pos=1.07, #subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", #subtitle_size='xx-large' ) -fig_plt.savefig('../images/bignums-bls12-pairings-rust-vs-wasm-exec-startup-time.png', bbox_inches='tight') - # ## spectrum of bignum host funcs -# In[182]: +# In[ ]: include_engines_list = ['rust-native', 'v8-liftoff', 'v8-turbofan', @@ -3774,30 +3774,79 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_scout_bls12_hostfunc_variations = df_scout_bls12_hostfunc_variations.groupby(['engine']).mean() -# In[183]: +# In[ ]: -fig_plt = plotOneTestColoredTicksBLS(df_scout_bls12_hostfunc_variations, +plotOneTestColoredTicksBLS(df_scout_bls12_hostfunc_variations, + '../images/bignums-bls12-pairings-host-func-variations-total-time.png', suptitle="BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)", suptitle_pos=1.02, #subtitle="ecpairing-zkrollup-rust-wasm-bn128-two-pairings\n", #subtitle_size='xx-large', highlight_ticks=["wabt-with-bignums"]) -fig_plt.savefig('../images/bignums-bls12-pairings-host-func-variations-total-time.png', bbox_inches='tight') - -# In[184]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_scout_bls12_hostfunc_variations, +plotScoutStackedTest(df_scout_bls12_hostfunc_variations, + '../images/bignums-bls12-pairings-host-func-variations-exec-startup-time.png', suptitle="BLS12-381 two-point pairing check (Rust-eip1962 vs Wasm-wasmsnark)", suptitle_pos=1.07, #subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", #subtitle_size='xx-large' ) -fig_plt.savefig('../images/bignums-bls12-pairings-host-func-variations-exec-startup-time.png', bbox_inches='tight') + +# In[ ]: + + + + + +# ## BLS12 - wabt vs wabt-with-bignums vs native + +# In[ ]: + + +include_engines_list = ['rust-native', 'wabt-fastmont-fasthost-superops', + 'wabt-no-bignums'] + +include_bench_names = ['bls12-wasmsnark-two-pairings', + 'bls12-wasmsnark-two-pairings-standalone', + 'bls12-eip1962-rust-native-two-pairings'] + +# bls12-wasmsnark-two-pairings-standalone +# bls12-wasmsnark-synth-loop + +df_wabt_bls12 = prepDfForRollupPlot(df_scout_data, + None, + include_bench_names, + only_include_engines=include_engines_list, + rename_engines=[ + ['wabt-fastmont-fasthost-superops', 'wabt-with-bignums'] + ]) + +df_wabt_bls12 = df_wabt_bls12.groupby(['engine']).mean() + + +# In[ ]: + + +plotScoutStackedTest(df_wabt_bls12, + '../images/bignums-bls12-pairings-wabt-vs-native-exec-startup-time.png', + suptitle="BLS12-381 two-point pairing check", + suptitle_pos=0.94, + subtitle="", + #subtitle="wasmnark (on wabt and wabt-with-bigums) vs eip1962 (rust-native)\n", + #subtitle_size='xx-large' + ) + + +# In[ ]: + + + # In[ ]: @@ -3808,7 +3857,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ## fizzy vs wabt - BLS12 -# In[185]: +# In[ ]: include_engines_list = ['rust-native', 'fizzy-with-bignums', 'wabt-fastmont-fasthost-superops', @@ -3832,28 +3881,27 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_fizzy_bls12 = df_fizzy_bls12.groupby(['engine']).mean() -# In[186]: +# In[ ]: df_fizzy_bls12 -# In[187]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_fizzy_bls12, +plotScoutStackedTest(df_fizzy_bls12, + '../images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png', suptitle="BLS12-381 two-point pairing check (fizzy vs wabt, rust-eip1962 vs wasmsnark)", suptitle_pos=1.07, #subtitle="ecpairing-zkrollup-websnark-bn128-two-pairings\n", #subtitle_size='xx-large' ) -fig_plt.savefig('../images/bignums-bls12-pairings-fizzy-vs-wabt-exec-startup-time.png', bbox_inches='tight') - # ## BLS12 synth loop -# In[188]: +# In[ ]: include_engines_list = ['fizzy-with-bignums', 'wabt-fastmont-fasthost-superops'] @@ -3874,26 +3922,25 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_bls12_synth_loop = df_bls12_synth_loop.groupby(['engine']).mean() -# In[189]: +# In[ ]: df_bls12_synth_loop -# In[190]: +# In[ ]: -fig_plt = plotScoutStackedTest(df_bls12_synth_loop, +plotScoutStackedTest(df_bls12_synth_loop, + '../images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png', suptitle="BLS12-381 synthetic loop (fizzy vs wabt - wasmsnark)", suptitle_pos=0.96, subtitle="", #subtitle_size='xx-large' ) -fig_plt.savefig('../images/bignums-bls12-synth-loop-fizzy-vs-wabt-exec-startup-time.png', bbox_inches='tight') - -# In[191]: +# In[ ]: include_engines_list = ['fizzy-with-bignums', 'wabt-fastmont-fasthost-superops'] @@ -3911,20 +3958,19 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False ]) -# In[192]: +# In[ ]: -fig_plt = plotOneTestGroupedExexTime(df_bls12_synth_vs_pairing, - title="BLS12-381 two pairings vs synthetic loop - wasmsnark (fizzy vs wabt)", +plotOneTestGroupedExexTime(df_bls12_synth_vs_pairing, + '../images/evm384-bls12-synth-loop-vs-pairings.png', + #title="BLS12-381 two pairings vs synthetic loop - wasmsnark (fizzy vs wabt)", + title="Figure 2: BLS12-381 two pairings vs synthetic loop", test_title="", group_order=['bls12-synth-loop', 'bls12-two-pairings'], sort_by=['bls12-synth-loop'], colors=['tab:orange', 'tab:blue']) -fig_plt.savefig('../images/evm384-bls12-synth-loop-vs-pairings.png', bbox_inches='tight') - - # In[ ]: @@ -3939,19 +3985,19 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[193]: +# In[ ]: df_evm384 = df_evm_raw[df_evm_raw['engine'] == 'evmone384'] -# In[194]: +# In[ ]: df_evm384 -# In[195]: +# In[ ]: df_scout_rust_native = df_scout_data[df_scout_data['engine'] == 'rust-native'] @@ -3961,7 +4007,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_scout_rust_native_bls12 = df_scout_rust_native_bls12.groupby(['engine']).mean() -# In[196]: +# In[ ]: # proposed gas from EIP-2537, for a BLS12-381 pairing operation is 23000*k + 115000 where k is a number of pairs. @@ -3972,7 +4018,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_scout_rust_native_bls12['test_name'] = "bls12-eip1962-rust-native-two-pairings" -# In[197]: +# In[ ]: df_scout_rust_native_bls12 @@ -3984,7 +4030,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[198]: +# In[ ]: df_scout_rust_native_bls12_merge = df_scout_rust_native_bls12.copy() @@ -3994,7 +4040,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_scout_rust_native_bls12_merge = df_scout_rust_native_bls12_merge[['engine','test_name','time','gas']] -# In[199]: +# In[ ]: df_scout_rust_native_bls12_merge @@ -4006,14 +4052,14 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[200]: +# In[ ]: df_evm384_merge = df_evm384.copy() df_evm384_merge.columns = ['engine', 'test_name', 'time', 'gas'] -# In[201]: +# In[ ]: df_evm384_merge @@ -4021,7 +4067,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False # ## TODO: scale synthetic loop time/gas by a factor determined from the wasm runtimes (wasm-pairing / wasm-synth-loop) -# In[202]: +# In[ ]: df_evm384_native = pd.concat([df_evm384_merge, df_scout_rust_native_bls12_merge], sort=False) @@ -4029,13 +4075,13 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm384_native.set_index('engine', inplace=True) -# In[203]: +# In[ ]: df_evm384_native -# In[204]: +# In[ ]: df_evm384_native['time'] = pd.to_numeric(df_evm384_native['time']) @@ -4044,7 +4090,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False df_evm384_native['Mgas/s'] = (df_evm384_native['gas'] / df_evm384_native['time']) * (1 / 10**6) -# In[205]: +# In[ ]: df_evm384_native @@ -4062,7 +4108,7 @@ def plotEVMvsWasm(df_evm_vs_wasm, colors=['tab:blue', 'tab:orange'], dodge=False -# In[206]: +# In[ ]: def byEngineExecTime(df_benchdata, engine): @@ -4071,7 +4117,7 @@ def byEngineExecTime(df_benchdata, engine): return df_benchdata.loc[engine]['time'].max() -def plotTimeVsGas(df_benchdata, title=""): +def plotTimeVsGas(df_benchdata, filepath, title=""): #sorted_engines = sorted(['evmone384', 'rust-native'], key=lambda x: byEngineExecTime(df_benchdata, x)) columns_to_plot = ['time'] df_plotdata = df_benchdata.copy() @@ -4119,15 +4165,16 @@ def plotTimeVsGas(df_benchdata, title=""): f.suptitle(title, fontsize=16, y=1.22) f.subplots_adjust(hspace=0.5) - return f + f.savefig(filepath, bbox_inches='tight') + plt.close('all') -# In[207]: - +# In[ ]: -fig_plt = plotTimeVsGas(df_evm384_native, "bls12-381 pairings: rust-native precompile vs evm384 synthetic loop") -fig_plt.savefig('../images/evm384-bls12-synth-loop-vs-native-rust.png', bbox_inches='tight') +plotTimeVsGas(df_evm384_native, + '../images/evm384-bls12-synth-loop-vs-native-rust.png', + "bls12-381 pairings: rust-native precompile vs evm384 synthetic loop") # In[ ]: @@ -4144,13 +4191,13 @@ def plotTimeVsGas(df_benchdata, title=""): # ## bls12 pairings and synth loop - wasm, evm384, rust-native -# In[208]: +# In[ ]: df_bls_wasm_merge = df_bls12_synth_vs_pairing.copy() -# In[209]: +# In[ ]: df_bls_wasm_merge.drop(columns=['parse_time', 'exec_time'], inplace=True) @@ -4159,14 +4206,14 @@ def plotTimeVsGas(df_benchdata, title=""): df_bls_wasm_merge.drop(columns=['engine', 'bench_name'], inplace=True) -# In[210]: +# In[ ]: df_bls_wasm_merge = df_bls_wasm_merge.groupby(['engine_bench_name']).mean() df_bls_wasm_merge.reset_index(inplace=True) -# In[211]: +# In[ ]: df_bls_wasm_merge @@ -4184,7 +4231,7 @@ def plotTimeVsGas(df_benchdata, title=""): -# In[212]: +# In[ ]: df_evm384_native_merge = df_evm384_native.copy() @@ -4193,26 +4240,26 @@ def plotTimeVsGas(df_benchdata, title=""): df_evm384_native_merge.columns = ['engine', 'bench_name', 'time'] -# In[213]: +# In[ ]: df_evm384_native_merge -# In[214]: +# In[ ]: df_evm384_native_merge['engine_bench_name'] = df_evm384_native_merge['engine'] + "--" + df_evm384_native_merge['bench_name'] -# In[215]: +# In[ ]: df_evm384_native_merge.drop(columns=['engine', 'bench_name'], inplace=True) df_evm384_native_merge = df_evm384_native_merge[['engine_bench_name', 'time']] -# In[216]: +# In[ ]: df_evm384_native_merge @@ -4230,7 +4277,7 @@ def plotTimeVsGas(df_benchdata, title=""): -# In[217]: +# In[ ]: df_evm384_wasm_native = pd.concat([df_evm384_native_merge, df_bls_wasm_merge], sort=False) @@ -4238,21 +4285,20 @@ def plotTimeVsGas(df_benchdata, title=""): df_evm384_wasm_native.set_index('engine_bench_name', inplace=True) -# In[218]: +# In[ ]: df_evm384_wasm_native -# In[219]: +# In[ ]: -fig_plt = plotOneTestUsingTimeCol(df_evm384_wasm_native, +plotOneTestUsingTimeCol(df_evm384_wasm_native, + '../images/evm384-bls12-pairings-synth-loop-rust-wasm.png', suptitle="BLS12-381 pairings and synthetic loop - rust-native, wasm, evm384", suptitle_pos=1.02) -fig_plt.savefig('../images/evm384-bls12-pairings-synth-loop-rust-wasm.png', bbox_inches='tight') - # In[ ]: @@ -4266,20 +4312,20 @@ def plotTimeVsGas(df_benchdata, title=""): -# In[220]: +# In[ ]: df_evm384_wasm_synth_loop = df_evm384_wasm_native.copy() df_evm384_wasm_synth_loop.reset_index(inplace=True) -# In[221]: +# In[ ]: df_evm384_wasm_synth_loop = df_evm384_wasm_synth_loop[df_evm384_wasm_synth_loop['engine_bench_name'].str.contains("synth")] -# In[222]: +# In[ ]: df_evm384_wasm_synth_loop.set_index('engine_bench_name', inplace=True) @@ -4291,15 +4337,314 @@ def plotTimeVsGas(df_benchdata, title=""): -# In[223]: +# In[ ]: -fig_plt = plotOneTestUsingTimeCol(df_evm384_wasm_synth_loop, +plotOneTestUsingTimeCol(df_evm384_wasm_synth_loop, + '../images/evm384-bls12-synth-loop-wasm.png', suptitle="BLS12-381 synthetic loop - wasm and evm384", suptitle_pos=1.02) -fig_plt.savefig('../images/evm384-bls12-synth-loop-wasm.png', bbox_inches='tight') -fig_plt.show() + +# In[ ]: + + + + + +# ## evm384 concluding tldr chart + +# In[ ]: + + +df_bls_wasm_merge_tldr = df_bls12_synth_vs_pairing.copy() +df_bls_wasm_merge_tldr.drop(columns=['parse_time', 'exec_time'], inplace=True) + + +# In[ ]: + + +df_evm384_native_merge_tldr = df_evm384_native.copy() +df_evm384_native_merge_tldr.drop(columns=['gas', 'Mgas/s'], inplace=True) +df_evm384_native_merge_tldr.reset_index(inplace=True) +df_evm384_native_merge_tldr.columns = ['engine', 'bench_name', 'time'] + + +# In[ ]: + + +df_evm384_wasm_native_tldr = pd.concat([df_evm384_native_merge_tldr, df_bls_wasm_merge_tldr], sort=False) +df_evm384_wasm_native_tldr.reset_index(drop=True, inplace=True) + + +# In[ ]: + + +df_evm384_wasm_native_tldr = df_evm384_wasm_native_tldr.drop(df_evm384_wasm_native_tldr[df_evm384_wasm_native_tldr['engine'] == 'fizzy-with-bignums'].index) + + +# In[ ]: + + +df_evm384_wasm_native_tldr = df_evm384_wasm_native_tldr.sort_values('time') + + +# In[ ]: + + +df_evm384_wasm_native_tldr.replace('bls12-eip1962-rust-native-two-pairings', 'Native two-pairings (Rust)', inplace=True) +df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v2', 'EVM384 synth-loop-v1 (Yul)', inplace=True) +df_evm384_wasm_native_tldr.replace('evm384-synth-loop-v1', 'EVM384 synth-loop-v2 (Yul)', inplace=True) +df_evm384_wasm_native_tldr.replace('bls12-synth-loop', 'Wasm synth-loop (wasmsnark)', inplace=True) +df_evm384_wasm_native_tldr.replace('bls12-two-pairings', 'Wasm two-pairings (wasmsnark)', inplace=True) +#df_evm384_wasm_native_tldr.replace('blake2b-8kb.huff.evm', 'EVM (Huff)', inplace=True) + + +# In[ ]: + + +f = plt.figure(figsize=(14,8)) +sns.reset_defaults() # use default colors, orange and blue +splot = sns.barplot(x='engine', y='time', hue='bench_name', dodge=True, ci=None, + palette=['tab:orange', 'tab:blue', 'tab:olive', 'tab:purple', 'tab:brown'], + data=df_evm384_wasm_native_tldr) + + + +# this customizes the widths of each bar-group. Because orange bars (wasm) stand alone, +# versus blue and olive that are grouped together (evm-huff, evm-sol), but the default +# widths are all the same, the orange bars are too skinny. +# This makes the orange bars fatter (`current_width*2`) than the blue and olive bars (`current_width*1.3`) + +# It also adjusts the x position of the bars so that they're centered (by default they were positioned +# as if all three groups would appear in every column) + +orange_bars_rgba = (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0) +blue_bars_rgba = (0.19460784313725488, 0.45343137254901944, 0.632843137254902, 1.0) +olive_bars_rgba = (0.6622549019607844, 0.6651960784313725, 0.2093137254901961, 1.0) +purple_bars_rgba = (0.5784313725490194, 0.446078431372549, 0.6990196078431372, 1.0) +brown_bars_rgba = (0.5171568627450981, 0.3583333333333334, 0.3259803921568628, 1.0) + + +for patch in splot.patches: + current_width = patch.get_width() + # factor 1.3 to make bars 30% wider? + diff = current_width*1.3 - current_width + + # orange - couldn't find a way to look up patch color names nor covert RGB to name, + # so we look up the bar groups using these HSLA(?) values like (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0) + if patch.get_facecolor() == orange_bars_rgba: + diff = current_width*2 - current_width + patch.set_width(current_width*1.3) + patch.set_x(patch.get_x() + diff * 1.85) + + #blue + if patch.get_facecolor() == blue_bars_rgba: + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() + diff * 1.7) + + #olive + if patch.get_facecolor() == olive_bars_rgba: + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() + diff * 1.7) + + # purple + if patch.get_facecolor() == purple_bars_rgba: + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() - diff * 5.0) + + # brown + if patch.get_facecolor() == brown_bars_rgba: + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() - diff * 5.0) + + + #print(dir(patch)) + #print(patch) + #print(patch.get_facecolor()) + + +# annotate the bars with the ms values +for p in splot.patches: + splot.annotate( + toMs(p.get_height()), + (p.get_x() + p.get_width() / 2., p.get_height()), + ha = 'center', va = 'center', + xytext = (0, 10), + textcoords = 'offset points') + + +# adjust legend placement +plt.legend(fontsize='x-large', title_fontsize='40', loc='upper left') +#leg = splot.get_legend() +#leg.set_bbox_to_anchor([0.212,0.95]) + +splot.set_xticklabels(splot.get_xticklabels(), size = 14) +splot.set(xlabel='') + +#f.suptitle("Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)", fontsize=18, y=0.96) +#f.suptitle("Two-pairings (Rust-native, wasm) vs Synthetic loop (wasm, evm384)", fontsize=18, y=0.96) +f.savefig('../images/evm384-wasm-native-pairings-and-synth-loop.png', bbox_inches='tight') +plt.close('all') + + +# In[ ]: + + + + + +# ## Plot the evm384 adjusted time + +# In[ ]: + + +df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr.copy() + + +# In[ ]: + + +wasm_pairing_time = df_evm384_wasm_native_tldr_adjusted.loc[(df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'Wasm two-pairings (wasmsnark)'), 'time'] +wasm_synth_time = df_evm384_wasm_native_tldr_adjusted.loc[(df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'Wasm synth-loop (wasmsnark)'), 'time'] + +adjustment_factor = wasm_pairing_time.mean() / wasm_synth_time.mean() + + +# In[ ]: + + +adjustment_factor + + +# In[ ]: + + +df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr_adjusted.drop(df_evm384_wasm_native_tldr_adjusted[df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'Wasm synth-loop (wasmsnark)'].index) +df_evm384_wasm_native_tldr_adjusted = df_evm384_wasm_native_tldr_adjusted.drop(df_evm384_wasm_native_tldr_adjusted[df_evm384_wasm_native_tldr_adjusted['bench_name'] == 'EVM384 synth-loop-v1 (Yul)'].index) + + +# In[ ]: + + +df_evm384_wasm_native_tldr_adjusted.loc[(df_evm384_wasm_native_tldr_adjusted['engine'] == 'evmone384'), 'time'] *= adjustment_factor + + +# In[ ]: + + +evm384_legend_label = "EVM384 estimate (synthetic adjustment factor {:0.2f})".format(adjustment_factor) + +df_evm384_wasm_native_tldr_adjusted.replace('EVM384 synth-loop-v2 (Yul)', evm384_legend_label, inplace=True) + + +# In[ ]: + + +f = plt.figure(figsize=(14,8)) +sns.reset_defaults() # use default colors, orange and blue +splot = sns.barplot(x='engine', y='time', hue='bench_name', dodge=True, ci=None, + palette=['tab:orange', 'tab:olive', 'tab:pink'], + data=df_evm384_wasm_native_tldr_adjusted) + + + +# this customizes the widths of each bar-group. Because orange bars (wasm) stand alone, +# versus blue and olive that are grouped together (evm-huff, evm-sol), but the default +# widths are all the same, the orange bars are too skinny. +# This makes the orange bars fatter (`current_width*2`) than the blue and olive bars (`current_width*1.3`) + +# It also adjusts the x position of the bars so that they're centered (by default they were positioned +# as if all three groups would appear in every column) + +orange_bars_rgba = (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0) +blue_bars_rgba = (0.19460784313725488, 0.45343137254901944, 0.632843137254902, 1.0) +olive_bars_rgba = (0.6622549019607844, 0.6651960784313725, 0.2093137254901961, 1.0) +purple_bars_rgba = (0.5784313725490194, 0.446078431372549, 0.6990196078431372, 1.0) +brown_bars_rgba = (0.5171568627450981, 0.3583333333333334, 0.3259803921568628, 1.0) +pink_bars_rgba = (0.8372549019607844, 0.5196078431372548, 0.7401960784313724, 1.0) + + +for patch in splot.patches: + current_width = patch.get_width() + # factor 1.3 to make bars 30% wider? + diff = current_width*1.3 - current_width + + # orange - couldn't find a way to look up patch color names nor covert RGB to name, + # so we look up the bar groups using these HSLA(?) values like (0.8818627450980391, 0.5053921568627451, 0.17303921568627467, 1.0) + if patch.get_facecolor() == orange_bars_rgba: + diff = current_width*2 - current_width + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() + diff * 1.0) + + #olive + if patch.get_facecolor() == olive_bars_rgba: + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() + diff * 0.1) + + # pink + if patch.get_facecolor() == pink_bars_rgba: + patch.set_width(current_width*1.0) + patch.set_x(patch.get_x() - diff * 3.2) + + + #print(dir(patch)) + #print(patch) + #print(patch.get_facecolor()) + + +# annotate the bars with the ms values +for p in splot.patches: + splot.annotate( + toMs(p.get_height()), + (p.get_x() + p.get_width() / 2., p.get_height()), + ha = 'center', va = 'center', + xytext = (0, 10), + textcoords = 'offset points') + + +# adjust legend placement +plt.legend(fontsize='x-large', title_fontsize='40', loc='upper left') +#leg = splot.get_legend() +#leg.set_bbox_to_anchor([0.212,0.95]) + +splot.set_xticklabels(splot.get_xticklabels(), size = 14) +splot.set(xlabel='') + +#f.suptitle("Two-pairings (Rust-native, wasm) vs Estimated-two-pairings (evm384 adjusted-synth-loop)", fontsize=18, y=0.96) +#f.suptitle("BLS12-381: Estimated runtime for two pairings on EVM384", fontsize=18, y=0.96) +f.savefig('../images/evm384-wasm-native-pairings-vs-adjusted-synth-loop.png', bbox_inches='tight') +plt.close('all') + + +# In[ ]: + + + +# test to make sure that scout wasm3 data is present +plotOneTestColoredTicks(df_scout_data[df_scout_data['engine'].isin(['wasm3-with-bignums'])], + '../images/.scout_wasm3_test1_png') + + +# In[ ]: + + + +# test to make sure that scout_wamr.c data is present +plotOneTestColoredTicks(df_scout_data[df_scout_data['engine'].isin(['wasm3-with-bignums'])], + '../images/.scout_wasm3_test2_png') + + +# In[ ]: + + + + + +# In[ ]: + + + # In[ ]: