#rustbook — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #rustbook, aggregated by home.social.
-
HashMap в Rust: SwissTable, SIMD по 16 байт за раз и RawTable, который от вас спрятали
Привет, Хабр! Признавайтесь: вы пользуетесь std::collections::HashMap примерно каждый день и ни разу не задумывались, что под ним. А под ним, если коротко, сидит алгоритм от Google. С Rust 1.36 (это лето 2019-го) стандартный HashMap это порт SwissTable, той самой структуры из абсейловского flat_hash_map . До этого там был Robin Hood hashing, и если вы где-то ещё видите описание std-мапы как «linear probing and Robin Hood bucket stealing», знайте: оно протухло, актуальная документация уже пишет «quadratic probing and SIMD lookup». И вот «SIMD lookup» это самое интересное. Весь фокус скорости SwissTable держится на одном байте служебных данных на элемент, который сканируется по 16 штук за одну инструкцию процессора. В статье глянем, как это устроено внутри, почему ваша мапа по умолчанию устойчива к hash DoS и платит за это скоростью, когда в проде стоит переходить на FxHash, и почему низкоуровневый RawTable существует, но в публичном HashMap его спрятали. Будет много кода и немного ассемблерной романтики .
-
HashMap в Rust: SwissTable, SIMD по 16 байт за раз и RawTable, который от вас спрятали
Привет, Хабр! Признавайтесь: вы пользуетесь std::collections::HashMap примерно каждый день и ни разу не задумывались, что под ним. А под ним, если коротко, сидит алгоритм от Google. С Rust 1.36 (это лето 2019-го) стандартный HashMap это порт SwissTable, той самой структуры из абсейловского flat_hash_map . До этого там был Robin Hood hashing, и если вы где-то ещё видите описание std-мапы как «linear probing and Robin Hood bucket stealing», знайте: оно протухло, актуальная документация уже пишет «quadratic probing and SIMD lookup». И вот «SIMD lookup» это самое интересное. Весь фокус скорости SwissTable держится на одном байте служебных данных на элемент, который сканируется по 16 штук за одну инструкцию процессора. В статье глянем, как это устроено внутри, почему ваша мапа по умолчанию устойчива к hash DoS и платит за это скоростью, когда в проде стоит переходить на FxHash, и почему низкоуровневый RawTable существует, но в публичном HashMap его спрятали. Будет много кода и немного ассемблерной романтики .
-
HashMap в Rust: SwissTable, SIMD по 16 байт за раз и RawTable, который от вас спрятали
Привет, Хабр! Признавайтесь: вы пользуетесь std::collections::HashMap примерно каждый день и ни разу не задумывались, что под ним. А под ним, если коротко, сидит алгоритм от Google. С Rust 1.36 (это лето 2019-го) стандартный HashMap это порт SwissTable, той самой структуры из абсейловского flat_hash_map . До этого там был Robin Hood hashing, и если вы где-то ещё видите описание std-мапы как «linear probing and Robin Hood bucket stealing», знайте: оно протухло, актуальная документация уже пишет «quadratic probing and SIMD lookup». И вот «SIMD lookup» это самое интересное. Весь фокус скорости SwissTable держится на одном байте служебных данных на элемент, который сканируется по 16 штук за одну инструкцию процессора. В статье глянем, как это устроено внутри, почему ваша мапа по умолчанию устойчива к hash DoS и платит за это скоростью, когда в проде стоит переходить на FxHash, и почему низкоуровневый RawTable существует, но в публичном HashMap его спрятали. Будет много кода и немного ассемблерной романтики .
-
I'm still just in chapter 4 of the Rust Book but I wanted to practice what I learned so far so I made my first Rust application, a simple dice roller.
I had to search a bit to use the Clap crate for CLI arg parsing.
-
I'm still just in chapter 4 of the Rust Book but I wanted to practice what I learned so far so I made my first Rust application, a simple dice roller.
I had to search a bit to use the Clap crate for CLI arg parsing.
-
I'm still just in chapter 4 of the Rust Book but I wanted to practice what I learned so far so I made my first Rust application, a simple dice roller.
I had to search a bit to use the Clap crate for CLI arg parsing.
-
I'm still just in chapter 4 of the Rust Book but I wanted to practice what I learned so far so I made my first Rust application, a simple dice roller.
I had to search a bit to use the Clap crate for CLI arg parsing.
-
I'm still just in chapter 4 of the Rust Book but I wanted to practice what I learned so far so I made my first Rust application, a simple dice roller.
I had to search a bit to use the Clap crate for CLI arg parsing.
-
La version française du #rustbook est juste abandonné ou comment ça se passe ?
Je demande pour savoir si ça vaut le coup de suivre cette version du Rust-book (ne serait-ce par comfort, par rapport au risque d'obsolescence de certains points) -
La version française du #rustbook est juste abandonné ou comment ça se passe ?
Je demande pour savoir si ça vaut le coup de suivre cette version du Rust-book (ne serait-ce par comfort, par rapport au risque d'obsolescence de certains points) -
La version française du #rustbook est juste abandonné ou comment ça se passe ?
Je demande pour savoir si ça vaut le coup de suivre cette version du Rust-book (ne serait-ce par comfort, par rapport au risque d'obsolescence de certains points) -
La version française du #rustbook est juste abandonné ou comment ça se passe ?
Je demande pour savoir si ça vaut le coup de suivre cette version du Rust-book (ne serait-ce par comfort, par rapport au risque d'obsolescence de certains points) -
La version française du #rustbook est juste abandonné ou comment ça se passe ?
Je demande pour savoir si ça vaut le coup de suivre cette version du Rust-book (ne serait-ce par comfort, par rapport au risque d'obsolescence de certains points) -
I wish I'd read the following two articles right after reading the #rustbook.
They've been written in 2015 and have some outdated bits. But still bring a lot of value to an overall understanding of #rustlang
The first article covers "two pillars of Rust's design:
- Memory safety without garbage collection
- Concurrency without data races"https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html
The second article explores "the third pillar
- Abstraction without overhead"
-
I wish I'd read the following two articles right after reading the #rustbook.
They've been written in 2015 and have some outdated bits. But still bring a lot of value to an overall understanding of #rustlang
The first article covers "two pillars of Rust's design:
- Memory safety without garbage collection
- Concurrency without data races"https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html
The second article explores "the third pillar
- Abstraction without overhead"
-
I wish I'd read the following two articles right after reading the #rustbook.
They've been written in 2015 and have some outdated bits. But still bring a lot of value to an overall understanding of #rustlang
The first article covers "two pillars of Rust's design:
- Memory safety without garbage collection
- Concurrency without data races"https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html
The second article explores "the third pillar
- Abstraction without overhead"
-
I wish I'd read the following two articles right after reading the #rustbook.
They've been written in 2015 and have some outdated bits. But still bring a lot of value to an overall understanding of #rustlang
The first article covers "two pillars of Rust's design:
- Memory safety without garbage collection
- Concurrency without data races"https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html
The second article explores "the third pillar
- Abstraction without overhead"
-
I wish I'd read the following two articles right after reading the #rustbook.
They've been written in 2015 and have some outdated bits. But still bring a lot of value to an overall understanding of #rustlang
The first article covers "two pillars of Rust's design:
- Memory safety without garbage collection
- Concurrency without data races"https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html
The second article explores "the third pillar
- Abstraction without overhead"
-
@lisyarus
You probably already know this, but Chapter 4 of the #rustBook discusses ownership.https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
Not that I'm an expert; I'm only on chapter 8.
-
@lisyarus
You probably already know this, but Chapter 4 of the #rustBook discusses ownership.https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
Not that I'm an expert; I'm only on chapter 8.
-
@lisyarus
You probably already know this, but Chapter 4 of the #rustBook discusses ownership.https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
Not that I'm an expert; I'm only on chapter 8.
-
@lisyarus
You probably already know this, but Chapter 4 of the #rustBook discusses ownership.https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
Not that I'm an expert; I'm only on chapter 8.
-
@wizzwizz4 Well spotted! That's a trivial example from the #RustBook.
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#references-and-borrowing
I just wanted to make a joke with that Space Odyssey reference
-
@codesections Thanks!
The Rust Programming Language 2018 edition is now on IPFS.
https://ipfs.io/ipfs/QmZSNcZ2do5Li6vzLPvKQm3UsArryAWkzznFionLunxSR5/
(I found all files in ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/book/2018-edition, I think they were pre-generated)