Skip to content

selectFrom and rearrange (vectorized lookup tables) are going to be slow #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lemire opened this issue Jun 18, 2024 · 2 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@lemire
Copy link
Member

lemire commented Jun 18, 2024

When parsing strings with SIMD instructions, vectorized table lookup like vpshufb (x64) or vtbl (NEON) are critically important. They are very cheap (often run in 1 cycle) and very powerful. And indeed, the simdjson-java library makes extensive use of rearrange and selectFrom (part of the Java Vector API). At a glance, it may appear that rearrange and selectFrom are just wrapper around the fast underlying instructions (e.g., vpshufb or vtbl). But they are not. They generate a long flow of instructions. So it is unlike C#/dotnet where you have Ssse3.Shuffle or AdvSimd.Arm64.VectorTableLookup for example.

Thus, I am afraid that it its current state, Java Vector might be "performance challenged". It is simply too high level.

I have reported the design issue. See https://mail.openjdk.org/pipermail/panama-dev/2024-June/020476.html

@lemire lemire added the documentation Improvements or additions to documentation label Jun 18, 2024
@arouel
Copy link

arouel commented Oct 21, 2024

@lemire thank you for your review and sharing this information here and on the panama mailing list. I hope the conversion is fruitful. Especially, John Rose's answer let me hope for an API. Should we take up the matter again on the mailing list?

@lemire
Copy link
Member Author

lemire commented Oct 21, 2024

@arouel I definitively think that it is worth following up... especially as new Java releases come around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants