update puzzle with values from benchmark_python

This commit is contained in:
Tiziano Zito 2024-08-05 16:33:56 +02:00
parent 3357e17e4f
commit 7a46f3c939

View file

@ -31,8 +31,8 @@
"source": [ "source": [
"# create a collection of time series\n", "# create a collection of time series\n",
"# in real life, this data comes from an experiment/simulation\n", "# in real life, this data comes from an experiment/simulation\n",
"n_series = 30\n", "n_series = 128\n",
"len_one_series = 2**21 # ➔ 2^21 ≈ 2 millions (8Bytes x 2^21/2^20 [MB] = 16 MB)\n", "len_one_series = 2**15 # ➔ 2^15 = 32768 items (8 B x 2^15 = 262144 B = 256 K)\n",
"time_series = []\n", "time_series = []\n",
"for idx in range(n_series):\n", "for idx in range(n_series):\n",
" time_series.append(np.zeros((len_one_series,1), dtype='float64'))" " time_series.append(np.zeros((len_one_series,1), dtype='float64'))"
@ -52,9 +52,9 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# how much memory does one time series need?\n", "# how much memory does one time series need?\n",
"ts_size = time_series[0].nbytes/2**20 # -> 2^20 is 1MB\n", "ts_size = time_series[0].nbytes/2**10 # -> 2^10 is 1 K\n",
"print('Size of one time series (MB):', ts_size)\n", "print(f'Size of one time series: {int(ts_size)} K')\n",
"print('Size of collection (MB):', n_series*ts_size)" "print(f'Size of collection: {int(n_series*ts_size/1024)} M')"
] ]
}, },
{ {
@ -138,7 +138,9 @@
"execution_count": null, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": [
"# on my machine: 2.2 ms vs 33.9 ms ≈ 15x slowdown!!!"
]
} }
], ],
"metadata": { "metadata": {