From e19c3cf77eaff9162e93f713b77463cb0a495a43 Mon Sep 17 00:00:00 2001 From: octoflar Date: Sun, 30 Jun 2024 17:31:00 +0200 Subject: [PATCH] Update: benchmarks --- amber-tests/benchmarks.ipynb | 57 ++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/amber-tests/benchmarks.ipynb b/amber-tests/benchmarks.ipynb index e5c512d..10a9ccd 100644 --- a/amber-tests/benchmarks.ipynb +++ b/amber-tests/benchmarks.ipynb @@ -174,7 +174,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "20.8 ms ± 170 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n" + "20.4 ms ± 400 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n" ] } ], @@ -224,7 +224,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "21.4 ms ± 313 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" + "21.6 ms ± 643 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" ] } ], @@ -281,7 +281,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "20.9 ms ± 77.1 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n" + "20.8 ms ± 390 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n" ] } ], @@ -401,7 +401,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1.51 s ± 2.55 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" + "1.55 s ± 95.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" ] } ], @@ -458,7 +458,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "32.6 ms ± 3.33 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" + "31.3 ms ± 858 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" ] } ], @@ -551,7 +551,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1.47 ms ± 39.8 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n" + "1.27 ms ± 131 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n" ] } ], @@ -597,7 +597,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1.88 ms ± 101 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n" + "1.91 ms ± 103 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n" ] } ], @@ -716,7 +716,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "410 ms ± 3.06 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" + "410 ms ± 3.65 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" ] } ], @@ -762,7 +762,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "806 ms ± 15 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" + "798 ms ± 15.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" ] } ], @@ -779,7 +779,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 40, "metadata": {}, "outputs": [ { @@ -789,7 +789,7 @@ " 0.50891279])" ] }, - "execution_count": 39, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -801,14 +801,14 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 41, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "155 ms ± 1.12 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" + "163 ms ± 10 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" ] } ], @@ -816,6 +816,37 @@ "%timeit b_poly(b, x)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Does `tensorflow` cache calculations?" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "157 ms ± 773 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" + ] + } + ], + "source": [ + "%timeit b_poly(b, np.random.rand(n, how_many)) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "No, it does not." + ] + }, { "cell_type": "code", "execution_count": null,