/rust/

C is dead.

Other urls found in this thread:

doc.rust-lang.org/1.8.0/book/inline-assembly.html
github.com/pravic/winapi-kmd-rs
en.wikipedia.org/wiki/Dunning–Kruger_effect
blog.risingstack.com/how-to-use-rust-with-node-when-performance-matters/
github.com/kostya/benchmarks/blob/master/matmul/matmul.c
github.com/kostya/benchmarks/blob/master/matmul/matmul.java
github.com/redox-os/kernel
insights.stackoverflow.com/survey/2017#most-loved-dreaded-and-wanted
en.wikipedia.org/wiki/Low-level_programming_language
twitter.com/AnonBabble

How many numbers?

NO ITS NOT YOU FUCKIGN MOUTH BREATHER C IS ALWAYS KING YOUR STUPID IMAGE COULD BE 100% MADE UP FOR ALL WE KNOW, AND EVEN IF IT IS A COMPARISON OF 3 PROGRAMS THAT GENERATE FIBONACCI NUMBERS IT IS IMPOSSIBLE TO COMPARE CROSS LANGUAGE THE ONLY USEFUL THING YOU COULD DO IS TRY TO LOOK AT THE ASSEMBLY OF C AND RUST

>finally learn C after Sup Forums convinced me it was the only relevant language to learn
>already deprecated

1. how many
2. what algorithm
based on these 2 I can even make js the fastest.

The funny thing with these benchmarks is it depends on implementation, so just wait until someone writes a better loop in C99 that has aliasing guarantees using the restrict keyword.

Rust does that fancy type checking or whatever so its faster than C which doesn't IN THIS PARTICULAR BENCHMARK okay

classic asm.js, constantly 2.5x slower than native C...

no it isn't you fucking cock eating sperglord

Cool, I was going to learn Rust any way.

recursive for C
memoization for rust
rust is superior desu =^.^=

A certain OO programming teacher I knew did demos where Java outperformed C, so this isn't very surprising.
There's always some small niche where you can do crazy shit.

Java would never be faster than C unless you actively gimp C

>recursive Fibonacci
Holy shit why?
People are taught this in school as the worst possible use of recursion.

A lot of work went into Java to make the performance not suck as much, and if you know the tricks it does you can properly optimize.

Except it's not the same thing at all with Rust. The very nature of Rust allows it to be a direct competitor to C in terms of performance. In fact, being faster than C is one of their goals.

Rust was always targeted at C++

Why are u so retarded ? How can u be this dumb? C is 1:1 translated to ASM without any overhead. If you did both implementations the same then C would blow java/rust/c++ twice fold.

Please stop using your brain. It's pulsing too much braindamage

you seriously do not know what you're talking about

>If you did both implementations the same then C would blow
>java
yes
>rust
not necessarily
>c++
not always

c,rust,every other shit ultimately completely BTFO

First day on Sup Forums? You don't know shit and it's so obvious that you're trying to fit in.

> C is 1:1 translated to ASM
no, there's almost always some kind of optimization done. not even -O0 is 1:1 translated to ASM
> without any overhead.
there is always overhead, (e.g. _start )

>C is 1:1 translated to ASM without any overhead.
This is the stupidest thing I have read all week. Congrats.

No there isn't. Not if you use a proper compiler like Intel XE

Really? How is this statement false? Do you see any overhead when looking at C asm output? Now look at rust.

Clearly you haven't been to the GPU threads.

doc.rust-lang.org/1.8.0/book/inline-assembly.html
rust is as low-level as C you dumbfuck

just because your mother did crack while being pregnant with you doesn't mean you should do crack too. you seriously fucked up your brain

Do you even know what Rust is?
github.com/pravic/winapi-kmd-rs

So having ability to do inline ASM is low level? How much to they pay you to shill this trash language?

No hate on me please, just because I can handle low level C instead of needing a compiler to check my mem moves/reads for me.
Yeah Rust is SJW garbage with "move semantics" "pattern matching" and other bloat overhead.

Masks are off.

Do you have PTSD from the night your mother dropped you?

I doubt there would be a place where the compiler would have to account for aliased pointers in whatever fibonacci function they used.

No but I have high enough IQ to be able to code in C without needing training wheels for something as trivial as software dev.

It's always the same story with C manlets

>I'm SMARTER than the compiler, I don't NEED any help, all of you are just sux

It would be adorable if it isn't pathetic

en.wikipedia.org/wiki/Dunning–Kruger_effect

Nice projection

Just learn Racket instead.

yeah okay buddy

>already deprecated
its been deprecated for YEARS, senpai

Sorry but I've read entire Intel software dev/arch manuals + other 20 C books. You can't touch me with your SJW crap.

>look at me I'm so smart I have to tell people how many books I've read to prove it
en.wikipedia.org/wiki/Dunning–Kruger_effect

You're either a troll or a genuine idiot. Based on your performance here I'm leaning towards the latter.

Post code

No i'm just stating that instead of telling everyone else they are dumb you should accept reality and realize you have broken legs so you need to use wheelchair.

Is your brain incapable of saving variables/their lifetime in your mind? Do you really need compiler to do that for you? Seriously?

You're mentally ill. Seek help.

>using non-ascii characters in your source

filtered

qft

Article from 2015 made by Node.JS developer

blog.risingstack.com/how-to-use-rust-with-node-when-performance-matters/

>using different algorithms
yeah, the test was not biased at all

fuck off with that turd language

How is your transition going?

>Sorry but I've read entire Intel software dev/arch manuals + other 20 C books
and yet understood none of it. it's not even funny anymore, but really really sad

Still waiting for that source code.

autism

iktfb

will C ever recover?

Remind me, which language is the kernel you are running written in?

>without needing training wheels
Bwahahahahahahahahahahaha

>C is 1:1 translated to ASM without any overhead.
This is of course not true and hasn't been true for over 20 years.

nice deflection faggot

>deflection
Sure, I'll deflect, once you post the source code of those benchmarks.

github.com/kostya/benchmarks/blob/master/matmul/matmul.c
github.com/kostya/benchmarks/blob/master/matmul/matmul.java

...

...

nice malloc u got there.nice ymm/zmm intrinsics, I see a lot of "register" keyword usage.

This is baby C, like someone who barely got hello world to work.

this is high quality. whoever made this knew what they were doing.

Its a real blog post by some node.js dev. blog.risingstack.com/how-to-use-rust-with-node-when-performance-matters/

However many it takes to see the minute differences.

If you read Agner Fog's 1st manual for C/ASM optimization he solves this problem with some bitmasking and simd ymm instructions which results in C being 45X faster (yeah 45 times)

Yeah, don't you see the chart? Clearly the kernel should be written in Numpy bruh.

>Agner Fog

You meant that AMD shill?

>2017.2
>ascii

>Remind me, which language is the kernel you are running written in?
Rust?
github.com/redox-os/kernel

I understand your point, but you picked wrong words.

1) You can program in whatever language you want but eventually it's translated to native assembly language of this cpu.

2) Unlike Java or Python, with C, the abstraction is minimal, C was known as portable assembly and the translation is fairly straightforward, almost 1:1 what means.

3) 99% of the assembly programmers cannot write a better assembly code than an optimizing C compiler produces for the same algorithm. (with the same selected instruction subset).

I program in C and x86 assembly since 2017 and as much as i try, gcc -O2 always outperform my direct assembly code.

So with the same algorithm and same cpu and the same instructions, if Rust is faster than C, it's by definition a flaw of C compiler. Because C is lower level than rust so the conversion (compilation) is more straight forward.

It's not like learning C takes longer than a weekend at most. The standard library literally fits on a postcard. No excuse for any programmer not to know it.

As for learning how to program in it securely, might as well give up before even starting.

>since 2017
wow, you must be an expert.

fixup:
>I program in C and x86 assembly since 2007

it's 2 am here dude :)

>C is lower level than rust
Not true. Where are you getting this shit?

>Because C is lower level than rust
This is how I know you don't know what you're talking about. Anything that can be programmed in C can be programmed in Rust. Operating systems and drivers are already being worked on with nothing but Rust and assembly.

an entire kernel was written in rust and you're trying to tell me C is lower level? the fuck are you on?

>Because C is lower level than rust so the conversion (compilation) is more straight forward.
Why don't C babbies do any research before crying on Sup Forums?

embarrassing post to be honest family

>You can program in whatever language you want but eventually it's translated to native assembly language of this cpu.
Not every language is compiled, moron.
>C
>almost 1:1 with assembly
This hasn't been true for decades.
Your third point is true though.

when i say lower level i didn't mean you cannot do the same things with the rust, it's a compiled systems programming language, you can do anything with it.

what i mean is, C was designed in a way that making a compiler for it is easier than many other languages.

- it only has data types that directly corresponds to the underlying machine. it doesn't have string type for example. floating point is included later when the machines supported it.
- it only has operators that directly corresponds to the underlying machine.

there are many other design choices in C that compilers and underlying machines were in mind.

in that sense, C is lower level than Go or Rust or D. it's not about the ability, my point is that C is translated to assembly much easier and more straight forward.

Okay, so you're completely changing the definition of the term "low-level" (which has been used for a few decades) for your own benefit and expecting us all to go along with it. Got it.

>Not every language is compiled, moron.
i wrote that sentence this is in mind.

there are some hardware that can run java bytecode directly, but in almost any case, the native assembly code(machine code actually) is what's running.

for interpreted languages like python, it's the interpreter, for bytecode languages like java it's the VM, nevertheless eventually it's the cpu specific machine code that runs.

>Not every language is compiled, moron.
it still holds for interpreted languages. the interpreter has to send instructions to the cpu in the end

>Holy shit why?
Why not? It's language's fault for not having memoization, not theory

that's not true, the real definition of low level is how close programming languages abstractions to the underlying instruction set of cpu.

a programming language with string data type as primitive type and operator like + to concat strings is higher level by definition.

it was never about the ability.

insights.stackoverflow.com/survey/2017#most-loved-dreaded-and-wanted
We did it!

en.wikipedia.org/wiki/Low-level_programming_language

>node js developer
dropped

>10 years
wow, so impressive

this takes 1.5s. but how many fib numbers you want?

there are types of optimizations not possible in C, even now you must pray to St. Dennis Ritchie that the compiler decides to turn optimizations on for a section of code without deleting your error handlers from UB because the language isn't expressive enough to handle that case

>C is 1:1 translated to ASM without any overhead.

That's pretty bad. A well written D code, in my machine, computes fib(5000) in 0.01s

Also,