Skip to content

[RFC] SIMD-accelerated whitespace and structural scanning for jiter #249

Description

@Angelebeats

Hi team,

Following the migration and focus on jiter as the core parser for Pydantic, I've been auditing the source (specifically crates/jiter/src/parse.rs around line 257) for potential throughput gains.

I noticed that eat_whitespace and structural scanning (e.g., in array_step and object_step) are currently implemented as scalar loops (while let Some(next) = self.data.get(self.index)). While jiter is already high-performing, these byte-by-byte checks can become a significant bottleneck for payloads with large arrays or substantial indentation.

I’m proposing a targeted SIMD-accelerated 'fast-path' for whitespace/structural skipping. By using platform-specific vectorized masks (e.g., _mm256_movemask_epi8 on x86 or NEON equivalents), we could potentially skip up to 32 bytes of padding/whitespace per cycle without changing the existing iterator architecture.

I have a prototype showing a measurable throughput increase on minified/large datasets. Would you be open to a PR that introduces optional SIMD structural scanning for jiter?

Looking forward to your thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions