Complexity n=1000 n=2000 Ratio
O(1) 0.3µs 0.1µs 0.3
O(log n) 1.0µs 0.8µs 0.8
O(n) 2156.8µs 4334.4µs 2.0
O(n log n) 4868.4µs 11602.0µs 2.4
O(n^2) 33093.7µs 137109.8µs 4.1
Theoretical ratio: O(1)≈1, O(log n)≈1.1, O(n)≈2, O(n log n)≈2.1, O(n^2)≈4 (measured values affected by cache and constant factors)
n log n n log n n^2 2^n
10 3.3 33 1e+02 1.0e+03
100 6.6 664 1e+04 1.3e+30
1000 10.0 9966 1e+06 1.1e+301
1000000 19.9 19931569 1e+12 astronomical
Context 1024 tokens: attention score matrix has 1,048,576 elements
Context 8192 tokens: attention score matrix has 67,108,864 elements
Context 131072 tokens: attention score matrix has 17,179,869,184 elements
Verification Log: 18_big_o.txt
Original companion example or verification log for the tutorial, preserved with user paths redacted; execution scope follows the recorded run.