HNHacker News
TopNewBestAskShowJobs

sakras

729 karma · joined September 15, 2019

Programmer interested in performance, new pieces of metal, compilers for them. Twitter: bztree Email: krassovskysasha@gmail.com Blog: https://save-buffer.github.io/
submissionscomments
sakras··on Spaced repetition for teaching two-year olds how to read
It’s an app for spaced repetition, but it also means “memorization” in Japanese.
sakras··on LMAX Disruptor – High Performance Inter-Thread Messaging Library
> batch your updates locally to issue fewer of them at least

I don’t know why I never thought of this, brilliant!

sakras··on OCaml: a Rust developer's first impressions
> it doesn’t offer tail-call elimination

Why not? I’ve heard people say this about C too and I never understood it: LLVM and GCC both have optimization passes that perform tail-call elimination.

sakras··on Halfsies
Funny that this comes up - a lot of times while watching YouTube I'll fidget by trying to highlight exactly half of the title. I check whether or not it's half by dragging the highlighted section over the other half. Glad there's a game for this now!
sakras··on What every developer should know about GPU computing
As of Volta, they have independent PCs with a warp optimizer that dynamically groups threads with the same program counter, so branches aren’t nearly as bad as they used to be.
sakras··on AMD Introduces New AMD Ryzen Threadripper 7000/Pro 7000 WX
> serial computation on a fixed dataset that can be threaded per data point. So if I have 32 data points it's only that parallel

The general rule of thumb is that within a generation, higher clock speed yields better performance per core. If you only have 32 data points, then you will probably get better performance with the 4 GHz 32-core CPU.

> if I'm doing a massive serial calculation does an individual core get to use the full cache

Your single core will get to use the entire L3 cache, but L2 and L1 caches are per-core and so your single core doing the work will not have access to those. So yes, there conceivably could be a benefit due to the larger L3 cache.

On a broader note, these kinds of factors (frequency, cache size, parallelism) tend to be extremely workload-specific and unpredictable, so the only real way to find out what's faster is to measure your specific workload.

sakras··on Snmalloc: A Message Passing Allocator
My threads generally don’t share memory inside the runtime. The only time they touch each others’ stuff is when they perform work stealing or memory stealing, and that’s all provided by the CL-Deque
sakras··on Snmalloc: A Message Passing Allocator
> contradicts shared-nothing architecture

Sort of? The stealing happens very rarely, only when the thread doesn’t have a page. It’s done using relaxed atomics, so synchronization is pretty mild in this case.

> bad data locality

This will be relevant when I make it NUMA-aware, but generally speaking this shouldn’t matter as each page is much bigger than a core’s L2 cache anyway. And also memory living in the deque is freed, I don’t think there’s generally expectations on locality of memory returned to you from the allocator.

sakras··on How LSP could have been better
Conway’s law at its finest!
sakras··on Snmalloc: A Message Passing Allocator
I'm messing around with implementing a parallel runtime system right now^, and I also had to implement a shared-nothing allocator. I ended up making each thread have a Chase-Lev Deque of 2MB pages. If you want to allocate a page, you do the usual pop-or-try-to-steal thing, and if that doesn't work, THEN you do the mmap to get another 2MB page. I was going to benchmark it and write a post about it, but I never got around to it. Glad shared-nothing allocation seems to be a problem worth solving.

^ actually it's basically implemented. I model-checked it with TLA+ and found a bug that I haven't fixed yet. Next up I'm writing a query engine on it.

sakras··on Thread-per-core
> The problem with work-stealing is that it means a task can run on one thread, pause, and then be started again on another thread: that’s what it means for the work to be stolen. This means that any state that is used across a yield point in that task needs to be thread-safe.

Do any existing "thread-per-core" systems actually provide yield points as a thing you can do? Most of my experience is with OpenMP (using both BSP and task parallelism) and a little bit of TBB (also task parallelism). If you want to yield in these systems, you break it up into two tasks.

> if state is moved from one thread to another, this introduces synchronization costs

This isn't obvious to me. If you're moving state, then there is no synchronization because only one thread is touching the state at any given point. Unless we're talking about synchronization due to starting a new task?

sakras··on Arena allocator tips and tricks
Fantastic article! I have a project with a similar arena allocator, so I'll definitely be taking some of these tricks. One thing my allocator does do is organize arenas into a linked list so that you can grow your size dynamically. However I really like the article's point that you're always going to be living within _some_ memory budget, so you might as well allocate everything up front into a giant arena, and then divide the giant arena up into smaller arenas.

Also I've heard that you can save an instruction when checking if your allocator is full by subtracting from the top, and checking the zero flag. It seems to complicate alignment logic. Does that ever end up mattering?

sakras··on Show HN: Unity like game editor running in pure WASM
Was it a 2D game engine? I recall before using Zero I used an engine called ProjectFUN, which is similar to what you described. That was around 2013 though, not 2002.
sakras··on Show HN: Unity like game editor running in pure WASM
Wow you guys wrote Zero Engine? I used it in summer camps at DigiPen a long time ago, I really enjoyed using it and programming in Zilch (I wrote an AI that played a galaga clone!). This Unity fiasco had me wondering how Zero was doing. Seems like it's going to have a resurgence! Super exciting!
sakras··on Show HN: Mana Pool – Market for Magic Cards
Feels like if this takes off there'll be an opportunity for arbitrage between TCGPlayer and Mana Pool. I see e.g. All Will Be One is $11.67 on TCGPlayer and $12.40 on Mana Pool. Though I haven't done the math to see what kind of fees there are.
sakras··on BtrBlocks: Efficient Columnar Compression for Data Lakes [pdf]
I’ve been really excited about this paper since I went to the presentation at SIGMOD for it. I think the key innovation here is that it’s the first open standard for a format that’s just a simple combination of lightweight encodings. As far as I’m aware, most columnar DBMS already have storage like this, so it’s not very novel from a technical perspective.

However, the data science/big data world has been bogged down by inefficient, clunky formats like Parquet for quite a while and so I applaud any steps towards bridging the gap between the two worlds.

sakras··on Lfortran: Modern interactive LLVM-based Fortran compiler
How does this compiler compare with Flang? I saw it shouted out on the main page but didn't really see any comparisons for why you'd pick one or the other.
sakras··on Saving Lives (2004)
I’ve tried to use it professionally, but always end up switching to my x86 desktop to profile my code, just so I can use V-Tune.

It’s missing any kind of deeper statistics such as memory bandwidth, cache misses, branch mispredictions, etc. I think fundamentally Apple is geared towards application development, whereas I’m working on more HPC-like things.

sakras··on Saving Lives (2004)
Instruments is not nearly good enough for any serious performance work. Instruments only tells me what percent of time is spent in which part of the code. This is fine for a first pass, but it doesn’t tell me _why_ something is slow. I really need a V-Tune-like profiler on macOS.
sakras··on Can you trust a compiler to optimize your code?
This is overall very solid. However you have to be careful to not go overboard with this line of reasoning. I've seen people try to explain away inefficient code by inventing a chain of optimizations that the compiler could conceivably do. If this chain is too long, it probably won't happen! The most common pitfall I've seen is relying on inlining too much (specifically a C++ template monster). As far as I can tell, compilers have a fixed number of inline passes, and don't keep inlining until they hit a fixed point.
sakras··on PRQL: Pipelined Relational Query Language
It's been really cool seeing PRQL come to life! I'm not involved with it, but I still remember the very first HN post about a year ago where it was just a proposal. And look at it now! It's really gaining steam, I'm really excited about it!
sakras··on Tinygrad and rusticl and aco: why not?
Just curious, have you tried adding a feature to TinyGrad? Or are you arguing in the abstract because TinyGrad is small?

Because I personally have tried, and found the code to be so code-golf and spaghetti-like that I gave up, it just wasn’t worth my time (even for the $1000 bounty).

sakras··on Invertible Bloom Lookup Tables with Less Randomness and Memory
Usually you'd just hash several different elements at once in a vectorized way.
sakras··on Invertible Bloom Lookup Tables with Less Randomness and Memory
I think the issue is awareness. The “modern” way to do it is to precompute a table of bit patterns, and use the bottom few bits of the hash to lookup the bit patterns and set them in the Bloom filter. I wrote a blog post about it if you’re curious: https://save-buffer.github.io/bloom_filter.html
sakras··on It Took Me a Decade to Find the Perfect Personal Website Stack – Ghost+Fathom
This has a lot of similarities to the setup I use: org-mode which lets me write my blog posts in markdown, and GitHub pages which hosts it for me. Except I don't have to pay 200 euros/year!

I guess I am missing analytics, but I don't use those anyway out of respect for my readers' privacy.

sakras··on Ask HN: Could you share your personal blog here?
Wow, thank you for the kind words! Really glad you liked it. I don’t have much experience with RSS but I will try to add a feed (hopefully within the next week or so)
sakras··on Ask HN: Could you share your personal blog here?
https://save-buffer.github.io/

Only one post at the moment (about Bloom filters), but I’m working on another one about compressing integers! My focus is on high performance data analytics—adjacent things.

sakras··on Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
Can you comment on what the paper gets wrong? It says that scalability with mmap is poor due to page table contention and others. How does LMDB manage to scale well with mmap? Is page table contention just not an issue in practice?
sakras··on The Password Game
Yeah I think there's a bug with the chess notation, I also had it tell me Rh3 was illegal notation. Interestingly Rf3 is not illegal notation but an illegal move for me.
sakras··on Time is not a synchronization primitive
The implementers of Google Spanner would like to have a word!
← PreviousPage 4 of 8Next →