Skip to content

Conversation

@pie-humble-pie
Copy link

The splitPart function is very allocation heavy. It first calculates all splits and then only returns the one indexed as requested by its argument. That is very allocation expensive when the index is very small and the separator is repeated several times.

This change optimizes splitPart to tokenize to a limit based on the index specified to reduce allocations

@pie-humble-pie pie-humble-pie marked this pull request as draft December 25, 2025 12:41
@pie-humble-pie pie-humble-pie marked this pull request as ready for review December 25, 2025 14:41
@pie-humble-pie pie-humble-pie marked this pull request as draft December 25, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant