|
375 | 375 | { |
376 | 376 | "cell_type": "code", |
377 | 377 | "execution_count": null, |
378 | | - "id": "dab1775e0dda", |
| 378 | + "id": "293502b9957b", |
379 | 379 | "metadata": {}, |
380 | 380 | "outputs": [], |
381 | 381 | "source": [ |
|
396 | 396 | "\n", |
397 | 397 | "\n", |
398 | 398 | "if __name__ == \"__main__\":\n", |
399 | | - " print(f\"{'bytes':>8} {'symbols':>9} {'seconds':>8} {'ns/symbol/merge':>16}\")\n", |
| 399 | + " print(f\"{'bytes':>8} {'symbols':>9} {'time':>9} {'per symbol, per merge':>22}\")\n", |
400 | 400 | " for _row in python_scaling():\n", |
401 | | - " print(f\"{_row['bytes']:8d} {_row['symbols']:9d} {_row['seconds']:8.3f}\"\n", |
402 | | - " f\" {_row['ns_per_symbol_per_merge']:16.1f}\")\n", |
| 401 | + " print(f\"{_row['bytes']:8d} {_row['symbols']:9d} {_row['seconds']:7.3f} s\"\n", |
| 402 | + " f\" {_row['ns_per_symbol_per_merge']:19.1f} ns\")\n", |
403 | 403 | " print(\"\\nSeconds roughly double when the corpus doubles. The last column is flat, and it\")\n", |
404 | 404 | " print(\"is the constant you are about to attack: the cost of one symbol, one time, here.\")" |
405 | 405 | ] |
|
921 | 921 | { |
922 | 922 | "cell_type": "code", |
923 | 923 | "execution_count": null, |
924 | | - "id": "f978bb688e2c", |
| 924 | + "id": "d058e7643bb7", |
925 | 925 | "metadata": { |
926 | 926 | "lines_to_next_cell": 1 |
927 | 927 | }, |
|
945 | 945 | " cpp_rows = cpp_scaling()\n", |
946 | 946 | " py_rows = python_scaling()\n", |
947 | 947 | " print(\"per symbol, per merge — the only column that can tell a constant from a curve\")\n", |
948 | | - " print(f\"{'symbols':>9} {'python ns':>11} {'c++ ns':>9} {'ratio':>9}\")\n", |
| 948 | + " print(f\"{'symbols':>9} {'python':>11} {'c++':>11} {'ratio':>9}\")\n", |
949 | 949 | " for p, c in zip(py_rows, cpp_rows):\n", |
950 | | - " print(f\"{c['symbols']:9d} {p['ns_per_symbol_per_merge']:11.1f}\"\n", |
951 | | - " f\" {c['ns_per_symbol_per_merge']:9.1f}\"\n", |
| 950 | + " print(f\"{c['symbols']:9d} {p['ns_per_symbol_per_merge']:8.1f} ns\"\n", |
| 951 | + " f\" {c['ns_per_symbol_per_merge']:8.1f} ns\"\n", |
952 | 952 | " f\" {p['ns_per_symbol_per_merge'] / c['ns_per_symbol_per_merge']:8.1f}x\")\n", |
953 | 953 | " print(\"\\nRead the two middle columns DOWN, not across. Each is roughly flat as the corpus\")\n", |
954 | 954 | " print(\"grows, and that flatness is the straight line — the same line in both languages.\")\n", |
|
0 commit comments