Live data from Hacker News

Ask HN: What's the fastest programming language with a large standard library?

news.ycombinator.com

31–36 of 36 posts

Re: Ask HN: What's the fastest programming language with a large standard library?

#31

Earlier quoted context omitted.

.NET's standard library is very heavily vectorized, vectorization is considered in all scenarios where it is applicable, the compiler will also apply it to copies of known length and string comparisons fully eliding and unrolling Memmove and SequenceEqual calls. The gives languages that run on top of .NET massive performance advantage in a variety of scenarios versus any other language - C++ and Rust stdlibs are far…

Rust has had a stable SIMD vector API[1] for a long time. But, it's architecture specific. The portable API[2] isn't stable yet, but you probably can't use the portable API for some of the more exotic uses of SIMD anyway. Indeed, that's true in .NET's case too[3]. So .NET has to rely on "manually vectorized with intrisics for each individual platform" as well. Rust does all this SIMD too. It just isn't in the standar…

Getting clarifications from the OG himself! :)

Indeed, I meant to say "portable SIMD API" but it got lost somewhere in the stream of consciousness - sorry.

As for limitations of using such APIs in the standard library - in case of .NET platform-specific paths mainly exist for the following reasons:

- To achieve optimal codegen with more specific instructions

- To account for platform differences that are not expressible through crossplat vectors (vpternlog on x86, tbl/tbx on Aarch64)

- The code was written before crossplat API was available and has not been updated yet

Another aspect of such API is that all intrinsics still consume the same unified group of Vector128/256/512 so that writing scenario-specific helper is still relatively easy, which is what bits of standard library often opt into.

Re: Ask HN: What's the fastest programming language with a large standard library?

#32

Earlier quoted context omitted.

Rust has had a stable SIMD vector API[1] for a long time. But, it's architecture specific. The portable API[2] isn't stable yet, but you probably can't use the portable API for some of the more exotic uses of SIMD anyway. Indeed, that's true in .NET's case too[3]. So .NET has to rely on "manually vectorized with intrisics for each individual platform" as well. Rust does all this SIMD too. It just isn't in the standar…

Getting clarifications from the OG himself! :) Indeed, I meant to say "portable SIMD API" but it got lost somewhere in the stream of consciousness - sorry. As for limitations of using such APIs in the standard library - in case of .NET platform-specific paths mainly exist for the following reasons: - To achieve optimal codegen with more specific instructions - To account for platform differences that are not expressi…

Right. I pointed it out because it isn't just about having portable SIMD that makes SIMD optimizations possible. Therefore, the lack of one in Rust doesn't have much explanatory power for why Rust's standard library doesn't contain SIMD. (It does have some.) It's good enough for things like memchr (well, kinda, NEON doesn't have `movemask`[1,2]), but not for things like Teddy that do multi-substring search. When you do want to write SIMD across platforms, it's not too hard to define your own bespoke portable API[3].

I'm basically just pointing out that a portable API is somewhat oversold, because it's not uncommon to need to abandon it, especially for string related ops that make creative use of ISA extensions. And additionally, that Rust unfortunately has other reasons for why std doesn't make as much use of SIMD as it probably should (the core/alloc/std split).

[1]: https://github.com/BurntSushi/memchr/blob/c6b885b870b6f1b9bf...

[2]: https://github.com/BurntSushi/memchr/blob/c6b885b870b6f1b9bf...

[3]: https://github.com/BurntSushi/aho-corasick/blob/f227162f7c56...

Re: Ask HN: What's the fastest programming language with a large standard library?

#33

Earlier quoted context omitted.

Getting clarifications from the OG himself! :) Indeed, I meant to say "portable SIMD API" but it got lost somewhere in the stream of consciousness - sorry. As for limitations of using such APIs in the standard library - in case of .NET platform-specific paths mainly exist for the following reasons: - To achieve optimal codegen with more specific instructions - To account for platform differences that are not expressi…

Right. I pointed it out because it isn't just about having portable SIMD that makes SIMD optimizations possible. Therefore, the lack of one in Rust doesn't have much explanatory power for why Rust's standard library doesn't contain SIMD. (It does have some.) It's good enough for things like memchr (well, kinda, NEON doesn't have `movemask`[1,2]), but not for things like Teddy that do multi-substring search. When you…

Heh, movemask keeps coming back. Rather than emulating it, it appears to be more efficient to separately handle IndexOfMatch, LastIndexOfMatch and GetMatchCount scenarios it is used for most of the time:

- https://github.com/dotnet/runtime/pull/94472/files#diff-5824... (it's closed for now but I'm hoping to get back to it at some point)

- https://github.com/jprochazk/tmi-rs/blob/ac3ce6aee8bbe038a98...

It can account for good 30% performance variance depending on the use case (on Apple's M-series cores).

Re: Ask HN: What's the fastest programming language with a large standard library?

#34

Earlier quoted context omitted.

Right. I pointed it out because it isn't just about having portable SIMD that makes SIMD optimizations possible. Therefore, the lack of one in Rust doesn't have much explanatory power for why Rust's standard library doesn't contain SIMD. (It does have some.) It's good enough for things like memchr (well, kinda, NEON doesn't have `movemask`[1,2]), but not for things like Teddy that do multi-substring search. When you…

Heh, movemask keeps coming back. Rather than emulating it, it appears to be more efficient to separately handle IndexOfMatch, LastIndexOfMatch and GetMatchCount scenarios it is used for most of the time: - https://github.com/dotnet/runtime/pull/94472/files#diff-5824... (it's closed for now but I'm hoping to get back to it at some point) - https://github.com/jprochazk/tmi-rs/blob/ac3ce6aee8bbe038a98... It can account…

That's what the `memchr` crate does. It uses `vshrn` just like in your links. And vpmaxq before even bothering with vshrn: https://github.com/BurntSushi/memchr/blob/c6b885b870b6f1b9bf...

Re: Ask HN: What's the fastest programming language with a large standard library?

#35
post #25

Earlier quoted context omitted.

> Amazing tooling. Apparently you're comparing to java 20 years ago. Not to modern dev friendly ecosystems.

I've used vscode with typescript and python, but I found the amount of detail and coverage the inspections intellij has are better. The profilers that Java have are also the best I've seen. The profilers can show you crazy details on SQL queries being run, that get traced all the way through to the http endpoints ( https://www.ej-technologies.com/resources/jprofiler/help/doc... ).

Been a Java developer for many years but I've never tried JProfiler. Is it free, no big catches?

Re: Ask HN: What's the fastest programming language with a large standard library?

#36
post #35
post #25

Earlier quoted context omitted.

I've used vscode with typescript and python, but I found the amount of detail and coverage the inspections intellij has are better. The profilers that Java have are also the best I've seen. The profilers can show you crazy details on SQL queries being run, that get traced all the way through to the http endpoints ( https://www.ej-technologies.com/resources/jprofiler/help/doc... ).

Been a Java developer for many years but I've never tried JProfiler. Is it free, no big catches?

No the 3rd party profilers aren't free. But they have free trials. Java flight recorder is free and has a lot of the features of the paid ones (like the SQL tab)

https://blogs.oracle.com/weblogicserver/post/jdbc-in-java-mi...

Post reply on HN