@musicmatze Hm, yes I know you can build another runtime in Rust, but tasks always have to be _cooperatively_ scheduled in that runtime and can't be preemptively scheduled (see my previous toot).

Interesting, thank you for the link. But they achieve it on the level of (lightweight) WASM processes and not in Rust async itself.

Would like to see some benchmarks.

@veer66

@veer66
Oh, I see, tokio has cooperative scheduling, because tasks have to actively yield control back to the scheduler (either through .await or yield_now()).

Learned something new today, thanks.๐Ÿ™‚

Preemptive multitasking:
en.wikipedia.org/wiki/Preempti

Cooperative multitasking:
en.wikipedia.org/wiki/Cooperat

@musicmatze

@veer66 Oh, yes, you are right that Tokio is not preemptive - sorry.

By "is creating a third-party runtime for Rust possible", do you mean a _preemptive_ one? If so, it apparently isn't possible:

"Unfortunately, Tokio is not able to use this technique as Rust's async generators do not provide any mechanism for executors (like Tokio) to inject such yield points." - Tokio blog

tokio.rs/blog/2020-04-preempti

@musicmatze

@veer66 Fun fact: Rust had green threads in the early days (pre 1.0?), but they have decided against it, which is a good thing, IMO, because a systems programming language should not bring it's own run time, but rather one should have exact control over threads and it's scheduling.

I think tokio does preemptive scheduling, no?

@musicmatze

@wilfredh Urgh, this is so true.

Methods like `drain` on collections are your friend:
doc.rust-lang.org/std/collecti

I've used it in one of my projects to basically every n-th iteration `drain` a hashmap, because it is likely that 90% of values can be thrown away.

I think it increased perf by ~20% or something. Crazy!

Here is the code section I'm talking about:
gitlab.com/janriemer/csv-diff/

In order to get this increase in performance you have to be memory-bound of course.

@musicmatze Ah, thanks.
On executor agnostic: yes, might not be a big issue.
Regarding Pin: Oh, interesting, that you don't really need it that much.๐Ÿ˜ฎ

I really need to do some async stuff to get a better understanding and intuition on it.
Idea: building a Texas Hold'em Poker game in actix and Bevy.๐Ÿ˜

But I have two other projects I need to "finish" first (not async, but one is multi-threaded).

@veer66

@musicmatze I might not be qualified to answer this (no XP), but what comes to mind is:

- make it easier to be executor agnostic: what if I'm on tokio, but the crate I want to use only supports async-std?
- does "Pin" really need to be exposed to programmers or can we abstract it somehow?
(fasterthanli.me/articles/pin-a)
- async overloading would be nice to have (apparently Swift does it), but not sure it will be possible in Rust:
blog.yoshuawuyts.com/async-ove

@veer66

@veer66 Yes, it's the hardest part of Rust IMO (haven't really done async stuff in Rust myself yet).

But the Rust community is actively working on it to make it better. ๐Ÿ™‚

rust-lang.github.io/wg-async/v

rust-lang.github.io/async-fund

I think it will be much easier to use in 2-3 years.

@sotolf
You can code from any device that has a browser, if you use the cloud IDE.

And you can always self-host it, if you want it to be _your machine_.

Not everything is black and white.

But I understand your concern. Once the Desktop IDE part is ready, you don't have to worry about "Cloud" anymore. ๐Ÿ˜‰

@appelgriebsch @array

@array @appelgriebsch @sotolf Ah, I didn't know their desktop app wasn't production-ready yet. Thank you for the pointer.

That's a shame.๐Ÿ˜•

@appelgriebsch @sotolf @array You might also be interested in Eclipse Theia - An Open, Flexible and Extensible Cloud & Desktop IDE Platform

theia-ide.org/

Has support for VS Code extensions, too.

@meena Hm...I don't know Go, but I just want to add that you might also want to filter out non-visible unicode chars:

invisible-characters.com/

See the next toot ๐Ÿ˜

@ru Tuesday:

Every Tuesday one shares a link of a browser tab that has been open for a while in their browser.๐Ÿ™‚

See the following conversation I had with @badtuple about it:
mastodon.technology/web/@badtu

๐Ÿ˜„

It's Tuesday, so here is mine:
Agile and the Long Crisis of Software:
logicmag.io/clouds/agile-and-t

@ru Hm...reminds me of rubberduck debugging:

rubber-duck-debugging.org/

Maybe we should let the ducks take over...ยฏ\_(ใƒ„)_/ยฏ

๐Ÿฆ†

No, seriously, don't be so hard on yourself. :blobheart:

now has almost 66,666 stars on ๐ŸŽ‰

Come on little crabbies, we can do it!๐Ÿฆ€

๐Ÿ˜„

Shitpost 

@davy The crabs are coming... ๐Ÿฆ€ ๐Ÿฆ€

@alcinnz "This is what I appreciate most about the Rust project: its concern for the experience of the human beings using the language." - Ceejbot

This!

Show older
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!