© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
4 replies
dreadfullydistinct

Why is my SIMD code slower than the scalar version?

I wrote the following to learn more about simd - it tries to find a substring

https://paste.mod.gg/jswpvcpgoxgo/0

I ran a benchmark on my machine, which is avx512, compared against when it goes down the scalar path by setting DOTNET_EnableHWIntrinsic=0.

In my benchmark I have 2 paragraphs of Lorem Ipsum (1156 chars length) and a search string of a few words (47 chars length).

The vector512 benchmark takes approx 2.8us and the scalar benchmark takes 4.1us which seems like a fairly large difference and indicative that I’ve done something wrong.

Is there any more profiling I can use to work out what went wrong?
BlazeBin - jswpvcpgoxgo
A tool for sharing your source code with the world!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Release slower than Debug
C#CC# / help
2y ago
why is my code weird??
C#CC# / help
13mo ago
✅ Why is my code still wrong?
C#CC# / help
3y ago
❔ Why is my grpc so much slower then my minimal api? Need The Csharp Gods
C#CC# / help
4y ago