logoalt Hacker News

Platform-Independent SIMD in Go

92 points • by yurivish • today at 11:47 AM • 24 comments • view on HN

Comments

qprofyeh • today at 12:21 PM

This feature opens many doors for optimizing low-level performance in Go projects, that are already running multicore. IIRC there aren’t a lot of languages with built-in std lib support for SIMD and variants. Love the way Go is trying new stuff lately.

➕ show 2 replies
u8 • today at 1:54 PM

This is why I love Go. Nobody was asking for this, but they took the time to do it right and continue to Push go as a memory safe, high-level systems language.

➕ show 2 replies
vlovich123 • today at 2:17 PM

> The interface conversion and type switch look like they should be inefficient, but the compiler-side implementation of simd specializes code and optimizes away the type switch.

I don’t understand this - how is it able to if the same go binary might run on unknown types? I’m assuming what it means is that the switch is implemented efficiently due to CPU branch prediction? I know fearless SIMD is doing cool stuff with static dispatch so that the feature set is checked just once at program start - is that what it means it’s doing under the hood? Very unclear.

➕ show 1 reply
physicsguy • today at 12:37 PM

Oh this is great, it was one of my biggest bugbears about Go since you almost always have to link C/C++ code to get the appropriate performance.

The one negative I'd say is that often autovectorisation is 'good enough' and this doesn't really tackle that gap.

➕ show 3 replies
fatty_patty89 • today at 1:27 PM

The problem with Go isn't performance but with the C/C++ interop overhead, even with the "30% less overhead" from a few updates ago which isnt true for 99% of cases, it isnt enough

➕ show 1 reply
karolist • today at 1:28 PM

Already using this for foreground estimation of cutouts in my project, around 30% speedup over non-SIMD, but the algorithm is probably not very optimised yet.

chrisjj • today at 2:22 PM

> Go 1.26 and 1.27 include experimental APIs for Single Instruction Multiple Data (SIMD) operations.

You'd think these people would know the meaning of API, no?