Repository navigation
Commit 6bf285b
Speed up decoding of oversized integers
Bigint.from_msgpack_ext rebuilt the integer by shifting and adding one
32-bit chunk at a time. Each step copies the whole growing bignum, so
decoding was quadratic in the payload length (a 1 MiB ext payload took
over 20 seconds). Convert the chunks to a hex string and parse it in a
single String#to_i(16), which runs in linear time.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 4aa8bb9 commit 6bf285b
1 file changed
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 60 | + | |
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
| |||
0 commit comments