You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[mypyc] Add write_i16_le and read_i16_le to librt.strings (#20745)
These are experimental optimized primitives for reading/writing 16-bit
binary integers. I'll later add support for other integer sizes and
floats, and big endian formats.
The main optimization here is to inline the hot paths of these
functions. Also the api is optimized for performance and not really
ergonomics, though I don't think the ergonomics are particularly bad.
When reading, the caller needs to keep track of the index to the bytes
object, and negative indexes aren't supported, but the latter doesn't
seem really useful for these kinds of primitives.
In a microbenchmark, these can be dozens of times faster than using
stdlib `struct` (when compiled).
It may still be possible to further optimize performance, but these seem
already pretty good.
I used coding agent assist but through small human reviewed increments.
0 commit comments