3 ms·
You must be trolling and not evaluating either on their current state, or have little understanding of the subject matter as others have pointed out. Please wr
by neonsunset 2y ago
You must be trolling and not evaluating either on their current state, or have little understanding of the subject matter as others have pointed out.
Please write an efficient text element scanner that uses all AVX512 vector width in Java that matches LLVM codegen and can take any* source of memory? You can easily do that in C#, it's impossible to do it in Java alone.
https://github.com/dotnet/runtime/blob/7cd8459e7bd3883f0aa86961c518948630dc2e49/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs#L1566-L1577 https://github.com/dotnet/runtime/blob/7cd8459e7bd3883f0aa86...
(it uses portable SIMD and monomorphized generics to express negation to deduplicate vectorized paths, just like you would do so in Rust, except it doesn't have portable SIMD in its standard library yet)
*C# 'ref' variables also known as byrefs also work as special GC-aware pointers which can target any memory - stack, GC heap or anything else including unmanaged source and GC is able to disambiguate that and handle that in a performant manner during mark and sweep. This way you can pass a slice from Rust, construct a Span<T> from its ptr and length and then transparently interoperate with the rest of CoreLib, you could do so with the pointers already to an extent, but those required object pinning which was undesirable for something that would be used so ubiquitously in the code that 99% of users end up utilizing without realizing so.
- Ygg2 2y ago> You must be trolling and not evaluating either on their current state I'm not trolling, are you projecting? You don't seem to understand the difference between Rust trait and C# interface, and confuse extension methods for `impl` blocks. I'm evaluating on the current state of the LANGUAGE, not the LIBRARIES. Likewise, I do this because language syntax changes tend to be much slower than libraries. Think of it this way: In one year or twenty, Java and C# will have GC, while Rust will not (at least not by default), versus C# having Portable SIMD and Java and Rust not having it atm. I'm searching for truths that hold for as long as possible. > Please write an efficient text element scanner that uses all AVX512 you can easily do that in C#, it's impossible to do it in Java alone. You can use the Vector API (see https://openjdk.org/jeps/469 https://openjdk.org/jeps/469). See what I mean, when I say talking about something that's unlikely to change? If you were using older versions of Java you would abuse primitive types/ Unsafe package to get extra performance, and yes, dip into JNI if you really need some SIMD tricks. Yes, please tell me more about Span/ReadOnlySpan C# it's not like I wrote a parser (re)using them ad infinitum... /sarcasm The problem with C# and low-level coding, is that in GC-free C# land, you're on your own. Libraries are missing (i.e. they allocate a lot) or proprietary, Nullable is a horrible compromise, and C# enums are a joke compared to ADTs.
- neonsunset 2y agoPlease try using Vector API in Java, tell me how it goes (you demonstrably have no idea what you are talking about if you compare these with C# SIMD or think ADTs are not expressible in C#, I guess my last few years of experience with it were a mirage). But I will argue with you no more, you are welcome to stay in the swamp.
- Ygg2 2y ago> You demonstrably have no idea what you are talking about. Do you? You said you can't use AVX512 in Java I pointed out, yes you can. Especially now, but support for auto vectorization in Java has existed for quite some time. Also you have demonstrably no idea what ADTs are if you think you can use both sum and product types in C# see https://github.com/dotnet/csharplang/issues/113 https://github.com/dotnet/csharplang/issues/113 You argue that Rust a no-GC language is going to be similar to a GC language, especially one that was designed as direct competitor to Java? You're going to have to have post more proof than that. Sure Rust copied C# syntax, and C# copied some stuff from Rust, but C# copied way more of Java's semantics/syntax. You never addressed issues like way generics, trait and impl blocks work in Rust. You never addressed existence of inheritance in C#/Java. Or Rust trait solver or it's tagged (enum)/untagged unions. Nor its borrow checker, nor its AutoTraits, nor its Affine types. I've tried to argue with you in good faith, but you seem to have some issue with projecting your own issues onto me. > Please write an efficient text element scanner that uses AVX512 Here you go: https://github.com/simdjson/simdjson-java https://github.com/simdjson/simdjson-java