Readit News logoReadit News
gorset commented on Io_uring, kTLS and Rust for zero syscall HTTPS server   blog.habets.se/2025/04/io... · Posted by u/guntars
butterisgood · 2 days ago
Where do people get the idea that one thread per core is correct on a system that deals with time slices?

In my experience “oversubscribing” threads to cores (more threads than cores) provides a wall-clock time benefit.

I think one thread per core would work better without preemptive scheduling.

But then we aren’t talking about Unix.

gorset · 2 days ago
Isolating a core and then pinning a single thread is the way to go to get both low latency and high throughput, sacrificing efficiency.

This works fine on Linux, and common approach for trading systems where it’s fine to oversubscribe a bunch of cores for this type of stuff. The cores are mostly busy spinning and doing nothing, so it’s very inefficient in terms of actual work, but great for latency and throughput when you need it.

gorset commented on I wasted weeks hand optimizing assembly because I benchmarked on random data   vidarholen.net/contents/b... · Posted by u/thunderbong
gorset · a month ago
In a previous project we used fixedint32/64 instead of varint values in the schema for messages where performance was critical.

That left only varint used for tags. For encoding we already know the size at compile time. We also don’t have to decode them since we can match on the raw bytes (again, known at compile time).

A final optimization is to make sure the message has a fixed size and then just mutate the bytes of a template directly before shipping it off. Hard to beat.

In a newer project we just use SBE, but it lacks some of the ergonomics of protobuf.

gorset commented on Static search trees: faster than binary search   curiouscoding.nl/posts/st... · Posted by u/atombender
curiouscoding · 8 months ago
Hmm, bitmaps is an interesting idea! If the data is dense enough, then yeah I guess a quick linear scan would work.

There's also the extreme of simply storing the answer for each possible query as a u32 and just index the array, but there the overhead is much larger.

Rank-select is also interesting, but I doubt it comes anywhere close in performance.

I happen to also be working on a minimal perfect hashing project that has way higher throughput than other methods (mostly because batching), see https://curiouscoding.nl/posts/ptrhash-paper/ and the first post linked from there.

gorset · 8 months ago
Nice work! I love the care and discussion around low level optimizations, as such things are often ignored.

There are a lot of interesting variants of rank/select and other succinct data structures which has interesting tradeoffs. Maybe most useful when compression is critical. At least my own data structures can’t compete with the query performance you are showing, but they are great when the memory footprint matters.

gorset commented on Static search trees: faster than binary search   curiouscoding.nl/posts/st... · Posted by u/atombender
gorset · 8 months ago
The number of unique int32 values is not that great, and a full bitset would only be 512MB. Hard to bit a dense bitset in performance.

As a general purpose data structure, I would look at roaring bitmaps for this purpose, which has good trade-offs with great performance for most use-cases.

If only simple lookups are needed over a static set, then it's worth looking at minimal perfect hash functions (https://sux.di.unimi.it).

gorset commented on Faster CI with Selective Testing   mill-build.org/blog/3-sel... · Posted by u/lihaoyi
gorset · 8 months ago
Selective testing is great also for smaller projects to help keep velocity high for merging and working with branches with many commits.

I implemented selective testing using bazel for a CI some years ago, and it was painful to get it right. When finished even bigger branches would only take seconds-to-minutes to go through the pipeline, which was a significant improvement from the ~30 minutes build when I started working with the project, even though the project size grew a lot.

Glad to see mill-build is prioritizing this feature.

gorset commented on Fish 4.0: The Fish of Theseus   fishshell.com/blog/rustpo... · Posted by u/jdxcode
ComputerGuru · 8 months ago
We've actually added support to make single-binary fish deployments possible by (optionally) bundling static resources that would be part of the CMake-based deployment into the binary itself and having it unwrap those on first execution. The limitations of Cargo and the idiomatic `cargo install` usage primarily motivated this.
gorset · 8 months ago
I'm a big fan of this solution! It's always been annoying to perform all the ceremony involved in deploying a system with a bunch of files, with config, scripts and system written in a bunch of different languages.

In my current project I just wrote the installer and config generation as part of the main method. Gets rid of a lot of complexity, with a simpler build, and is arguably easier to maintain. Single language, single binary.

gorset commented on So you want to write Java in Neovim   ptrtojoel.dev/posts/so-yo... · Posted by u/ralphsebastian
fire_lake · 8 months ago
What’s the LSP tool that integrates with Bazel?

Is it open source?

gorset · 8 months ago
I always found the existing bazel integrations annoying. My solution has been to generate .classpath based on a set of bazel queries. Not what's officially recommended, but it has worked great for the projects I've been involved in. Easy to understand, and keeps bazel completely separate and independent from the IDE experience which has some benefits.
gorset commented on So you want to write Java in Neovim   ptrtojoel.dev/posts/so-yo... · Posted by u/ralphsebastian
gorset · 8 months ago
There's a lot of ceremony to run jdtls!

I find it easier to just install language servers using brew. Then the command can be simplified to

      cmd = { 'jdtls', '-data', home_dir .. '/.local/state/jdtls/' .. project_name },
My ftplugin/java.lua is about 100 lines, with most of it being settings and key bindings.

gorset commented on How Discord stores trillions of messages (2023)   discord.com/blog/how-disc... · Posted by u/jakey_bakey
vips7L · a year ago
> having just switched over from CMS (!)

This is really interesting. CMS was removed in Java 14 after being replaced by G1GC in Java 9. They were probably running an antiquated Java 8 or 11 runtime. So that means that in 2022 they were either running a 4 year old Java 11 runtime or an 8 year old Java 8 runtime. They were really leaving a lot of performance on the table.

gorset · a year ago
They could also have gone the commercial route and gotten Zing with their pauseless GC. It’s been around forever and they even cover Cassandra in their marketing.

https://www.azul.com/technologies/cassandra/

gorset commented on Git-absorb: Git commit –fixup, but automatic   github.com/tummychow/git-... · Posted by u/striking
keybored · a year ago
A branch with some base is already a series of commits. I don’t get where the conceptual re-imagining is here.
gorset · a year ago
Patch series comes from the linux kernel workflow, which git was developed to support. https://kernelnewbies.org/PatchSeries

In this workflow you review every commit and not just the branch diff. Each commit is crafted carefully, and a well crafter series of commits can make even very large changes a brief to review.

It takes a certain skill to do this well. As the page above says > Crafting patches is one of the core activities in contributing code to the kernel, it takes practice and thought.

This is in contrast to using git more as a distributed filesystem where you don't care particularly much about the history, and you typically squash commits before merging etc. It's simpler and easier to work this way, but you lose some of the nice attributes of the linux kernel workflow.

u/gorset

KarmaCake day256January 15, 2011
About
Programming, scalability and reliability. http://erik.gorset.no/
View Original