I've read an article explaining how they got such speed results. the answer was – they cheated. Wrote a pseudo code for a specific benchmark to reach these results.
The actual throughput of Asp was much more slower than Java and Go
You watch a few videos on how to do some simple html and JavaScript. A few videos down the line and youtube starts suggesting you this stuff. Yeah, I mean, I know some of the words used here, sure.
Hilariously C# doesn't have escape analysis (They're talking to the Java team on how best to do it from what I remember), meaning it doesn't even have the ability to allocate objects on anything but the heap, yet somehow still gets away with it
The Java servlet numbers are quite deceiving. First, servlets are outdated as hell as of today: something like Quarkus, Micronaut or Helidon are much better choices(especially in native mode using GraalVM). Furthermore, if you really want to use servlets, you should at least specify the vendor and the servlet environment where it's running
Span is one more proof that "make everything readonly" is idiotic idea. Why the hell I need new string if I want to capitalize the first letter?! No answer, just dumb repetition of ideas from functional programming.
I love these things. Using unsafe they can allow you to interpret an array as any type. Meaning a set of data can be a void*, int*, etc. its a game changer for making efficient code without excessive copies or garbage collections. Unfortunately, you get a warning for using it in c++/cli. I think its because the cli doesnt enforce a specific alloc method so it isnt entirely sure you arent putting it on the heap. Unfortunate, but it is what it is
Hey nick, would it be possible for you to create a video where a monolith can handle 100k request? I have been struggling with this for quite some time now. I am not able to send more than 5000 requests even on local host
Just FYI, the GC and benefits of Span are orthogonal. C/C++/Rust/etc. all benefit from avoiding heap allocations. Allocating on and freeing data from the heap are slow operations. In all languages, tuning for high performance always involves being very cognizant of allocations and how the data is used in memory. You'll pool memory (e.g. allocate once and reuse), optimize for data locality (e.g. using data-oriented design to optimize caching performance), and, in really extreme cases, probably come up with efficient ways to pack data to increase your cache's hit rate. Span is simply allowing a developer to tap into the same optimization patterns you'd find in those lower level languages, where they'd use pointers into preallocated hunks of memory (both heap and stack allocated).
Yes, GC causes pauses (e.g. batched "frees" — which is actually often faster overall, it just looks bad on a micro scale) on top of the standard heap allocation slowness, but it's the heap allocation we care about eliminating, not that the GC is bad for some reason.
Not only does it decrease heap allocations, but it also increases data locality. The CPU only has to find the value from the stack, which is much more likely to be in the CPU's cache than the heap objects.
I've spent my entire lockdown watching this channel. Maybe this will be a turning point in my luck. Love the aesthetics of the channel and thanks for the give ♋
Full video on Span: https://www.youtube.com/watch?v=FM5dpxJMULY
I wanna see the benchmark of Span<T> 😮
I've read an article explaining how they got such speed results.
the answer was – they cheated. Wrote a pseudo code for a specific benchmark to reach these results.
The actual throughput of Asp was much more slower than Java and Go
Love this short clips 🙂
Lol
So… char *…..
Is span<int> faster than int[]? I have no idea if int[] is allocated on the stack.
what Ide is on the video?
Love your videos! Great content! Keep up the good work!
Great content as always Nick
Great thanks
So you need concepts as abstract as classes and generic types just to use normal stack allocation.
Lame, Python is the fastest
I don't know but I'll try that in our app to see if this does help performance
People writing C: we had that from day 1!!!
For languages that don't run on the metal, the term "insanely fast" should always be taken with a few bushels of salt.
dotnet is nice, if you want to sell your soul to corporate
still far from Rust tho
so basically they made a garbage collector language fast by removing the garbage collector. Fantastic
Wow ❤️❤️
What's the java version of span? i noticed Java and C# copy each other (or c# copies Java). So there must be a java version of this me thinks.
short answer : it didnt 😛 c++ ftw
I always want to lean .NET or C# but when I google or youtube it I got lost
You watch a few videos on how to do some simple html and JavaScript. A few videos down the line and youtube starts suggesting you this stuff.
Yeah, I mean, I know some of the words used here, sure.
Meanwhile…..
Rust: I don't have such weaknesses
I'm so lost i swear it makes me doubt my chances of becoming an engineer
Ωραίος
Waht is you oppinion about Rust, Nick? Personally i like the idea of it, but the syntax is too complex
Fastest of the slowest is still slow.
But doesnt the garbage collector exist for a reason? Why cant I just deactivate it then entirely if Im just not zsing it anyways
Hilariously C# doesn't have escape analysis (They're talking to the Java team on how best to do it from what I remember), meaning it doesn't even have the ability to allocate objects on anything but the heap, yet somehow still gets away with it
rust is faster
The Java servlet numbers are quite deceiving. First, servlets are outdated as hell as of today: something like Quarkus, Micronaut or Helidon are much better choices(especially in native mode using GraalVM). Furthermore, if you really want to use servlets, you should at least specify the vendor and the servlet environment where it's running
Span is one more proof that "make everything readonly" is idiotic idea. Why the hell I need new string if I want to capitalize the first letter?! No answer, just dumb repetition of ideas from functional programming.
Nice date on your example project
I love these things. Using unsafe they can allow you to interpret an array as any type. Meaning a set of data can be a void*, int*, etc. its a game changer for making efficient code without excessive copies or garbage collections. Unfortunately, you get a warning for using it in c++/cli. I think its because the cli doesnt enforce a specific alloc method so it isnt entirely sure you arent putting it on the heap. Unfortunate, but it is what it is
Hey nick, would it be possible for you to create a video where a monolith can handle 100k request? I have been struggling with this for quite some time now. I am not able to send more than 5000 requests even on local host
Where is thr description?
Just FYI, the GC and benefits of Span are orthogonal. C/C++/Rust/etc. all benefit from avoiding heap allocations. Allocating on and freeing data from the heap are slow operations. In all languages, tuning for high performance always involves being very cognizant of allocations and how the data is used in memory. You'll pool memory (e.g. allocate once and reuse), optimize for data locality (e.g. using data-oriented design to optimize caching performance), and, in really extreme cases, probably come up with efficient ways to pack data to increase your cache's hit rate. Span is simply allowing a developer to tap into the same optimization patterns you'd find in those lower level languages, where they'd use pointers into preallocated hunks of memory (both heap and stack allocated).
Yes, GC causes pauses (e.g. batched "frees" — which is actually often faster overall, it just looks bad on a micro scale) on top of the standard heap allocation slowness, but it's the heap allocation we care about eliminating, not that the GC is bad for some reason.
Congratulations on such an amazing achievement, can't wait to see your channel grow even bigger. 🎩
Not only does it decrease heap allocations, but it also increases data locality. The CPU only has to find the value from the stack, which is much more likely to be in the CPU's cache than the heap objects.
I've spent my entire lockdown watching this channel. Maybe this will be a turning point in my luck. Love the aesthetics of the channel and thanks for the give ♋