Skip to content

[POC] feat: memchr-n#208

Draft
hsqStephenZhang wants to merge 1 commit into
BurntSushi:masterfrom
hsqStephenZhang:feat/memchrn
Draft

[POC] feat: memchr-n#208
hsqStephenZhang wants to merge 1 commit into
BurntSushi:masterfrom
hsqStephenZhang:feat/memchrn

Conversation

@hsqStephenZhang
Copy link
Copy Markdown

What's this PR about?

Implement shufti table based approach mentioned in #206 to support memchr-N (N could be arbitrary usize as long as shufti algo allows)

Background

see #206.

Implementation

  1. port shuffle_bytes and shift_8bit_lane_right methods from aho_corasick.
  2. add memchrn_iter, MemchrN public API

This is still experimental, and it adds many overhead for maintenance. Perhaps a better approach is to create a separate crate named memchr-n to support this feature.

The purpose of this PR(now) is mainly for discussion since its quite a big change. Comments are welcomed. (But don't get trapped in current code style)

@hsqStephenZhang hsqStephenZhang marked this pull request as draft February 28, 2026 17:47
@hsqStephenZhang hsqStephenZhang changed the title feat: memchr-n [POC] feat: memchr-n Feb 28, 2026
@hsqStephenZhang
Copy link
Copy Markdown
Author

if we wrap memchr-n over aho_corasick's Searcher, it works, but has some penalty for unnecessary abstraction.

@hsqStephenZhang
Copy link
Copy Markdown
Author

@BurntSushi Would you like to take a brief look? Do you think this approach is feasible? If so, I could fix the Ci problems and go on work on this PR.

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