Skip to content

[mypyc] specialise bytearray(bytes()[i:j]) - #21901

Open
hauntsaninja wants to merge 2 commits into
python:masterfrom
hauntsaninja:byteoptim
Open

[mypyc] specialise bytearray(bytes()[i:j])#21901
hauntsaninja wants to merge 2 commits into
python:masterfrom
hauntsaninja:byteoptim

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Fixes mypyc/mypyc#1216

Local compiled benchmarks showed approximately 1.8 to 2.1x speedup for 1 KiB and 1 MiB slices.

Authored-by: Codex

Fixes mypyc/mypyc#1216

Local compiled benchmarks showed approximately 1.8–2× speedup for 1 KiB and 1 MiB slices.

Authored-by: Codex

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It would be easy to extend this to also support bytearray(b[:n]) and bytearray(b[n:]), which may be fairly common (optional).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants