Commit 91fe2ed
committed
perf: pre-allocate buffer in VectorType.serialize for fixed-size elements
When subtype.serial_size() is known (e.g. FloatType, DoubleType,
Int32Type), pre-allocate a bytearray of exact size and write elements
via slice assignment instead of using io.BytesIO with dynamic growth.
This avoids BytesIO's internal buffer reallocation overhead for the
common case of fixed-size vector elements. Variable-size elements
continue to use BytesIO with uvint length prefixes.1 parent 91cd1ef commit 91fe2ed
1 file changed
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1483 | 1483 | | |
1484 | 1484 | | |
1485 | 1485 | | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
1489 | | - | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
1490 | 1501 | | |
1491 | | - | |
1492 | | - | |
| 1502 | + | |
| 1503 | + | |
1493 | 1504 | | |
1494 | 1505 | | |
1495 | 1506 | | |
| |||
0 commit comments