Static search trees: 40x faster than binary search
https://curiouscoding.nl/posts/static-search-tree/ [curiouscoding.nl]
2025-01-02 01:18
tags:
compsci
perf
programming
rust
In this post, we will implement a static search tree (S+ tree) for high-throughput searching of sorted data, as introduced on Algorithmica. We’ll mostly take the code presented there as a starting point, and optimize it to its limits. For a large part, I’m simply taking the ‘future work’ ideas of that post and implementing them. And then there will be a bunch of looking at assembly code to shave off all the instructions we can. Lastly, there will be one big addition to optimize throughput: batching.
https://en.algorithmica.org/hpc/data-structures/s-tree/
source: HN
Leaving Rust gamedev after 3 years
https://loglog.games/blog/leaving-rust-gamedev/ [loglog.games]
2024-04-28 02:32
tags:
development
gaming
programming
rust
This post isn’t a scientific evaluation or an A/B study. It’s my personal opinion after trying to make Rust gamedev work for us, a small indie developer (2 people), trying to make enough money to fund our development with it.
source: L
On Tech Debt: My Rust Library is now a CDO
https://lucumr.pocoo.org/2024/3/26/rust-cdo/ [lucumr.pocoo.org]
2024-03-26 20:59
tags:
development
library
rust
There is a joke that if there is tech debt, surely there must be derivatives to work with that debt? I’m happy to say that the Rust ecosystem has created an environment where it looks like one solution for tech debt is collateralization.
source: HN
Identifying Rust's collect::<Vec<_>>() memory leak footgun
https://blog.polybdenum.com/2024/01/17/identifying-the-collect-vec-memory-leak-footgun.html [blog.polybdenum.com]
2024-01-18 17:32
tags:
malloc
programming
rust
turtles
This is the story of how I identified the bug. (TLDR: collect::<Vec<_>>() will sometimes reuse allocations, resulting in Vecs with large excess capacity, even when the length is exactly known in advance, so you need to call shrink_to_fit if you want to free the extra memory.)
Ordinarily, that wouldn’t have been a problem, since the into_iter().map().collect() line used to pack them into (u32, u32)s would allocate a new vector with only the exact amount of space required. However, thanks to the allocation reuse optimization added in Rust 1.76, the new vec shared the backing store of the input vec, and hence had a capacity of 16560, meaning it was using 132480 bytes of memory to store only 16 bytes of data.
source: HN
Polonius update
https://blog.rust-lang.org/inside-rust/2023/10/06/polonius-update.html [blog.rust-lang.org]
2023-10-08 19:10
tags:
compiler
compsci
programming
rust
update
Polonius refers to a few things. It is a new formulation of the borrow checker. It is also a specific project that implemented that analysis, based on datalog. Our current plan does not make use of that datalog-based implementation, but uses what we learned implementing it to focus on reimplementing Polonius within rustc.
source: L
FAAS in Go with WASM, WASI and Rust
https://eli.thegreenplace.net/2023/faas-in-go-with-wasm-wasi-and-rust/ [eli.thegreenplace.net]
2023-05-11 21:07
tags:
go
programming
rust
wasm
web
This post is best described as a technology demonstration; it melds together web servers, plugins, WebAssembly, Go, Rust and ABIs. Here’s what it shows:
How to load WASM code with WASI in a Go environment and hook it up to a web server.
How to implement web server plugins in any language that can be compiled to WASM.
How to translate Go programs into WASM that uses WASI.
How to translate Rust programs into WASM that uses WASI.
How to write WAT (WebAssembly Text) code that uses WASI to interact with a non-JS environment.
source: L
How to Make Rust Leak Memory (Also: How to Make It Stop)
https://fly.io/blog/rust-memory-leak/ [fly.io]
2022-06-16 18:40
tags:
bugfix
investigation
malloc
programming
rust
Of course you can leak memory, even in Rust. For even medium-sized long-running applications, lots of graphs from a good memory profiler can make life better. And they’ll probably help you find the memory leak too.
How to speed up the Rust compiler in April 2022
https://nnethercote.github.io/2022/04/12/how-to-speed-up-the-rust-compiler-in-april-2022.html [nnethercote.github.io]
2022-04-13 20:08
tags:
compiler
development
perf
rust
update
In my last post I introduced the Compiler performance roadmap for 2022. Let’s see how things are progressing.
Along the way I had to undo some optimizations I had added to this code a couple of years ago. Those optimizations turned out to be useful for one kind of expensive macro (with many rules but no metavariables) present in the html5ever benchmark. But such macros aren’t common in practice, and these optimizations were unhelpful for more typical expensive macros, which are recursive, have fewer rules, and use metavariables. This shows the value of a good benchmark suite.
source: L
Why Rust mutexes look like they do
http://cliffle.com/blog/rust-mutexes/ [cliffle.com]
2022-04-02 05:25
tags:
concurrency
programming
rust
In the rest of this post I’ll walk through a typical C mutex API, compare with a typical Rust mutex API, and look at what happens if we change the Rust API to resemble C in various ways.
source: HN
Cranelift, Part 3: Correctness in Register Allocation
https://cfallin.org/blog/2021/03/15/cranelift-isel-3/ [cfallin.org]
2021-03-19 23:12
tags:
compiler
compsci
development
fuzzing
jit
programming
rust
testing
In this post, I will cover how we worked to ensure correctness in our register allocator, regalloc.rs, by developing a symbolic checker that uses abstract interpretation to prove correctness for a specific register allocation result. By using this checker as a fuzzing oracle, and driving just the register allocator with a focused fuzzing target, we have been able to uncover some very interesting and subtle bugs, and achieve a fairly high confidence in the allocator’s robustness.
source: HN
Rust after the honeymoon
http://dtrace.org/blogs/bmc/2020/10/11/rust-after-the-honeymoon/ [dtrace.org]
2020-10-11 20:55
tags:
development
programming
rust
So Rust is going really well for us at Oxide, but for the moment I want to focus on more personal things — reasons that I personally have enjoyed implementing in Rust. These run the gamut: some are tiny but beautiful details that allow me to indulge in the pleasure of the craft; some are much more profound features that represent important advances in the state of the art; and some are bodies of software developed by the Rust community, notable as much for their reflection of who is attracted to Rust (and why) as for the artifacts themselves.
source: L
Rust programming language exploit mitigations
http://rcvalle.blog/2020/09/16/rust-lang-exploit-mitigations/ [rcvalle.blog]
2020-10-02 21:28
tags:
compiler
defense
development
rust
security
This section documents the exploit mitigations applicable to the Rust compiler when building programs for the Linux operating system on the AMD64 architecture and equivalent.
source: L
Implementing a Type-safe printf in Rust
https://willcrichton.net/notes/type-safe-printf/ [willcrichton.net]
2020-08-17 04:35
tags:
programming
rust
text
type-system
I show how to use heterogeneous lists and traits to implement a type-safe printf in Rust. These mechanisms can ensure that two variadic argument lists share important properties, like the number of format string holes matches the number of printf arguments.
source: HN
"Rust does not have a stable ABI"
https://people.gnome.org/~federico/blog/rust-stable-abi.html [people.gnome.org]
2020-08-17 04:28
tags:
development
library
programming
rust
Or more exactly, why does this happen, and why do people perceive it as a problem?
source: L
xi-editor retrospective
https://raphlinus.github.io/xi/2020/06/27/xi-retrospective.html [raphlinus.github.io]
2020-07-01 00:55
tags:
compsci
concurrency
development
programming
rust
swtools
text
I still believe it would be possible to build a high quality editor based on the original design. But I also believe that this would be quite a complex system, and require significantly more work than necessary.
A few good ideas and observations could be mined out of this post.
source: L
Five Years of Rust
https://blog.rust-lang.org/2020/05/15/five-years-of-rust.html [blog.rust-lang.org]
2020-05-15 14:44
tags:
rust
update
With all that’s going on in the world you’d be forgiven for forgetting that as of today, it has been five years since we released 1.0 in 2015! Rust has changed a lot these past five years, so we wanted reflect back on all of our contributors’ work since the stabilization of the language.
source: L
Notes on Parsing in Rust
https://blog.wesleyac.com/posts/rust-parsing [blog.wesleyac.com]
2020-04-30 22:37
tags:
library
programming
rust
text
I’ve recently been writing a bit of parsing code in Rust, and I’ve been jumping back and forth between a few different parsing libraries - they all have different advantages and disadvantages, so I wanted to write up some notes here to help folks who are undecided choose what libraries and techniques to consider, and also to offer some suggestions for the future of the Rust parsing ecosystem.
source: L
Recent and future pattern matching improvements
https://blog.rust-lang.org/inside-rust/2020/03/04/recent-future-pattern-matching-improvements.html [blog.rust-lang.org]
2020-03-07 18:39
tags:
programming
rust
update
Much of writing software revolves around checking if some data has some shape (“pattern“), extracting information from it, and then reacting if there was a match. To facilitate this, many modern languages, Rust included, support what is known as “pattern matching”.
source: L
Rust Ownership Rules
https://www.geekabyte.io/2020/02/rust-ownership-rules.html [www.geekabyte.io]
2020-03-03 03:26
tags:
intro-programming
rust
In this post, I took the opportunity to re-summarise what I consider to be the essence of this ownership rules in Rust.
source: L
Allocator Designs
https://os.phil-opp.com/allocator-designs/ [os.phil-opp.com]
2020-02-05 05:48
tags:
malloc
programming
rust
rust
systems
This post explains how to implement heap allocators from scratch. It presents and discusses different allocator designs, including bump allocation, linked list allocation, and fixed-size block allocation. For each of the three designs, we will create a basic implementation that can be used for our kernel.