Rust doesn't support (actually, works against) concurrency through the language itself

>Rust doesn't support (actually, works against) concurrency through the language itself
>in a modern framework where parallel performance is key

what the fuck Jow Forums

Attached: Rust Programming Language-Interview Questions.jpg (340x361, 9K)

Other urls found in this thread:

doc.rust-lang.org/book/second-edition/ch16-00-concurrency.html#fearless-concurrency
github.com/mariomka/regex-benchmark
github.com/mariomka/regex-benchmark/issues/7
softwareengineering.stackexchange.com/questions/222642/are-go-langs-goroutine-pools-just-green-threads
github.com/dotnet/corefx/issues/24333
learnyouahaskell.com/making-our-own-types-and-typeclasses
twitter.com/AnonBabble

Shut the fuck up

>Rust doesn't support (actually, works against) concurrency through the language itself
explain

the power of mozilla shilling

But that's wrong, Rust is a leading innovator in Fearless Concurrency, Adaptive Parallelism, and Co-abstraction.

Educate yourself before spewing: doc.rust-lang.org/book/second-edition/ch16-00-concurrency.html#fearless-concurrency

>hurr if you let our compiler yell at you, it will somehow be easier to write concurrent code!
Fuck off, Rust does not provide the programmer with an easy way to program concurrently. It just catches errors. Go provides CSP, Erlang provides FP based concurrency. Rust provides a screaming feminist robot. Pic related

Attached: afc.png (500x499, 726K)

?
thread::spawn(|| {})

how is that "hard"

> Green threads
Enjoy your bottleneck

Attached: 1538143303183.png (1578x1668, 187K)

>almost a full second for checking if a string forms an IP address
How the fuck is this even possible? Link to issue?

go is truly one of the worst languages.
It offers horrible performance at no benefits. Pure meme language

How is it possible to be slower than Python.
>.NET/C#
Wow, just wow.

>C# Mono
>2.4 seconds to search a document for email addresses.
What the fuck.

It's not "checking if a string forms an IP address", it's searching through a document for matches. It's still slow, but it's not THAT slow.
github.com/mariomka/regex-benchmark

>github.com/mariomka/regex-benchmark
based Rust

>Why is C# slow
Because .NET is a subpar runtime. There's all there's to it. There exists no reason to use C# if you are not a MS fanboy.

Go doesn't actually use Green threads though, it uses M:N threads, where M green threads are mapped to N kernel threads, and erlang uses green threads, but erlangs threads are so much more powerful than what you would typically get.

>Go doesn't actually use Green threads
>where M green threads

Yeah, they aren't "green threads" in an and of them self, they are a small component of the threading model in Go. So saying Go uses green threads is incorrect, it uses M:N threads.

Rust has been one of the few languages I've been excited over learning, don't ruin this for me Jow Forums

>System: MacBook Pro (Retina, 15-inch, Late 2013), 2.3 GHz Intel Core i7, 16 GB 1600 Mhz DDR3 with macOS Sierra 10.12.5.
really makes me think.... yeah I mcfucking wonder why C# is ultra slow

github.com/mariomka/regex-benchmark/issues/7
mac shills begone

dumbass lmao

>he has to drop unicode support to become 12 times slower than Rust and 13 times slower than C

yea sweety that's a big YIKES from me

Goroutines are not technically green threads.
See: softwareengineering.stackexchange.com/questions/222642/are-go-langs-goroutine-pools-just-green-threads

None of that is actually enabling, they're just playing catch up because they're so anal on static checks. Concurrency wasn't a thing at all until like 2016

You fell for the meme. Check the github issue page, the benchmark includes compile times.

Meanwhile Servo is the most parallelized browser engine which was made possible by Rust. Explain?

How are the c and rust compile times so much faster? No optimization?

>made possible by Rust
It was possible in C++ too

man I tried compiling hello world in rust yesterday and rustc took a good 10 seconds. What the fuck.

fpbp

>C saving the world once again
Onle rust performances are acceptable in 2k18.

How come Rust is always so fast and yet Jow Forums keeps telling me that it's like 50 times slower than C++? Literally makes no sense.

They're probably referring to compile times. It's easily a 10-20x increase, maybe that 50x number isn't so unreasonable.

also template metaprogramming and gcc optimizations about function inlining, hot paths and loop unrolling.

The compile times are pretty slow, but Jow Forums mostly complains about how the compiler is strict and doesn't allow you to write whatever. They're also probably the same people who think the solution for billions of memory-related bugs and vulnerabilities in C/++ software is "lmao just get good programmers who never make mistakes"

its easy to teach and has all basic components a developer needs so even if it fails it will be used for educational purposes

couldn't you achieve the same result by just using C++ with stricter compiler flags? what makes Rust better syntactically?

Had no idea Mono was so slow

Rust is crap and every fucking place I go someone shills me REEEEEEEEEEE

I'm pretty sure "they" is in fact a "he".
The same faggot posting the same BS again and again, it's typical on this board.

>concurrency
>where parallel performance is key
>Doing any of this in anything but VHDL on an FPGA

Attached: 9842132132154.jpg (600x536, 77K)

They went for accuracy in emulating the original .net framework and they were willing to sacrifice performance for that.

Based PHP

It offers very good performance , you are just looking at an area it is really bad in.

the C in this image is using PCRE 2, which is obviously going to be slow. If they used C's built-in regex functions, it would blow rust out of the water.

C and C++ can't track the lifetime of an object the same way Rust can.
The languages simply lack the constructs to tell the compiler about who truly owns a resource and where it's going and who has the duty to clean it up etc.
C++ at least comes closer than C thanks to references and smart pointers, but it's no where near Rust and its borrow checker.

Every language that has used an M:N threading model has lived to regret it.

More like based PCRE (C).
It's not like regex is implemented in PHP. Then, PHP would be one of the slowest.

>C's built-in regex functions

Attached: 1540916378574.png (711x590, 395K)

man 3 regex brainlet

Attached: 1529256570452.png (688x380, 97K)

>JSöy cuck

PHP is made in C and its pretty damn fast, for backend at least.

PHP being made in C doesn't make it fast. It uses a fucking interpreter, the slowest code execution method known to man.

>
>"built-in"

Attached: 1539532169343.jpg (372x278, 9K)

implicit imports are gross in any language.

>POSIX only functions
>should be imported implicitly

>sys
>regex
>"built-in"
Being this fucking dumb should be made illegal

A C++ compiler cannot detect a race condition a compile time. Rust can, which is super useful for obvious reasons.

Do I learn Haskell or Rust?

Both are pointless wankery. But at least Rust is useful.

>t. oop pajeet

You're aware it's not a part of the C standard, right? Why would you make your program not cross platform?

>Rust
>OOP

Attached: 1538068292820.jpg (442x500, 8K)

how is rust oop?
global mutable variables literally dont exist in it...

>guys .net core guys c# is free software now time to rewrite all your software to glorious c# xD
>meh of course it's dogshit slow it's not even running on windows xD

>global mutable variables
just assign one outside a function and it is

The pinnacle of Rust's "concurrency."

Super useful for putting everything in sequentially consistent mode. Yeah no, that's not concurrency.

You're not wrong. Currently, working with threads in Rust isn't really more convenient than in other languages. The only thing the language does is yell at you if you're doing it wrong.

The Futures / Executor RFC will make offloading tasks to different threads much easier. Just like C#'s Task.Run. And you can asynchronously await them, too.

Actually some versions of PHP use jit, I think the newer version php 7 is jit and facebook has a JIT called HipHop Virtual Machine.

? how

>Nondeterminism is concurrency
How insightful

>choosing memory order like a white person is nondeterminism
The absolute state of Rustlets.

>VHDL
LMAO get the fuck out of here eurocuck, the real masters of silicon are here using systemverilog, back to your Intro to Digital Hardware Design class you freshman.

>error[E0373]: closure may outlive the current function, but it borrows `v`,
which is owned by the current function.
OK, so we don't know, so you better don't for just in case.

>help: to force the closure to take ownership of `v` (and any other referenced
variables), use the `move` keyword
Mmkay...

>error[E0382]: use of moved value: `v`

This is beyond pathetic, Rustlets. Concurrency is definitely too hard for you. I recommend you JavaScript instead.

Attached: 1533073087878.png (853x482, 433K)

>This is beyond pathetic, Rustlets.
What's pathetic is that you wrote code with a bug, but blamed the compiler for telling you about it.

>error[E0382]: use of moved value: `v`
You're trying to use v in your function after you moved it into the closure. You need to stop mashing the keyboard and think carefully through what the code you've written actually does. Chances are, you can probably just re-order your statements so that you're done with v before you move it into the closure.

if you still need v after the thread has been created in the current scope, literally just do v.clone(). otherwise get rid of the & and just put v in.

you cant borrow values into a new thread because the lifetime of the value cannot be known at compile time and so would/could result in dangling pointers.

>if you still need v after the thread has been created in the current scope, literally just do v.clone().
I would STRONGLY recommend against giving that advice.

Cloning will make the compiler warning go away, but might not solve the underlying issue with the program. If it's safe to clone a value and then reference it in several different places, the variable containing it probably ought to be immutable to begin with.

>wrote code with a bug
No, I'm just trying to share a collection between two threads. Rust answer is that you shouldn't, it is dangerous! Fuck off.

>moved value 'v'
It does not matter who "owns" v and whether or not it is left dangling. That is secondary. The real danger comes in the timing on writing and reading from it in multiple threads. No compiler can reason about this, it just becomes too complex. Rust answer is don't do it, which is not acceptable.

>The real danger comes in the timing on writing and reading from it in multiple threads. No compiler can reason about this, it just becomes too complex. Rust answer is don't do it, which is not acceptable.
thats what mutex and .lock() are for you fucking retard. did you even read The Book?

also mpsc::channel() with .send() and .recv() to pass values between threads

this is what your code looks like right?
fn main() {
let v = SomeValue;
thread::spawn(move || { let x = &v });
v = SomeNewValue; //use of moved value error
}


it should be

fn main() {
let (tx, rx) = mpsc::channel();
let v = SomeValue;
thread::spawn(move || {
let x = v;
tx.send(v).unwrap();
});
let v = rx.recv().unwrap();
v = SomeNewValue;
}

PHP is unironically the best non-compiled language today.
the world is just full of dipshits who literally only know Ruby/Python/Javascript and had some slightly-less-junior "dev" once tell them PHP sucks because they started "coding" in 2011 back when it actually did.

iow: haters gonna hate

I thought about porting some of my applications to Rust, but Rust just seems like an annoying hassle more than anything. Has a lot of nice features over C but the syntax is all over the place and Rusties love to rely on macros which by far have the most annoying naming schema: !

>No, I'm just trying to share a collection between two threads.
And you're doing it in an unsafe way.

>It does not matter who "owns" v and whether or not it is left dangling.
Rust's entire safety model is built around ownership and lifetimes.

>Rust answer is that you shouldn't, it is dangerous!
>Rust answer is don't do it, which is not acceptable.
Rust's answer is that you shouldn't do it unsafely. Do it properly or not at all.

>stuck with Java at work
>really want to start doing programs in other languages
>not sure which one to do that will be accepted at work

I was really considering doing some SBCL again, but then realized people will look at me like i'm insane. Plus when I leave im sure they'll just ditch it rather than try to find someone who can read it.

honestly just do python

Even taking into account the benchmark is seriously flawed, regex performance on dotnet is pretty damn slow (about 10% the speed of most everything else). This has been known for a long while, but nobody really gave a shit because if your application bottleneck is some regex then what the fuck are you doing?

Issue is tracked here
github.com/dotnet/corefx/issues/24333
But it's not scheduled for serious work anytime soon because nobody is banging on the door for it.

>You need to stop mashing the keyboard and think carefully through what the code you've written actually does.
Right. Then there's no need for a nanny compiler. C++ here I am!

If you were capable of this then you wouldn't be having any errors to begin with. C/C++ lets mediocre programmers pretend their geniuses by letting them compile ticking time bombs.

Strongly typed vs Dynamic Type, what do you guys like the most?

Strong but polymorphic is best
In an ideal world everything would have Haskell style type systems

What's so special about Haskell types?

REAL PROGRAMMERS WRITE THEIR OWN COMPILER

Implicit static typing for anything beyond a small script.

tsk tsk tsk
Studying ripgrep will not help. Rust is just faster and better than C#/botNET anytime

For one thing you can create type classes based on all sorts of predicates, so you can do things like implement a sort algorithm whose type is "any type on which >= and

They blow the socks off pretty much every other languages and are the most compelling reasons to use the language in production.

learnyouahaskell.com/making-our-own-types-and-typeclasses

How do I convince my boss to let me make applications with this? Can you have struct like types?

Attached: cat.jpg (869x1077, 139K)

Before you can write applications you'll have to learn the dark and perverse art of functional programming

>lying on the internet

Attached: 1540674216638.jpg (1280x1280, 330K)

>Right. Then there's no need for a nanny compiler. C++ here I am!
The point of compile-time checking is to catch when you make mistakes. It's not a replacement for needing to think.