HN user

dist1ll

1,582 karma

Working on RISC-V, operating systems and compilers.

https://alic.dev

https://github.com/dist1ll

Posts31
Comments281
View on HN
bitmath.blogspot.com 1y ago

Bit-permuting 16 u32s at once with AVX-512

dist1ll
51pts4
github.com 2y ago

Guide on optimizing Linux kernel with BOLT

dist1ll
12pts0
www.modular.com 2y ago

What Ownership Is About: A Mental Model Approach

dist1ll
1pts0
blog.cloudflare.com 2y ago

Every 7.8μs your computer's memory has a hiccup

dist1ll
12pts0
www.lighterra.com 2y ago

Modern Microprocessors – A 90-Minute Guide

dist1ll
2pts0
travisdowns.github.io 2y ago

Performance Speed Limits

dist1ll
2pts0
yoric.github.io 2y ago

So You Want to Optimize Your Code?

dist1ll
2pts0
lemire.me 2y ago

Recognizing string prefixes with SIMD instructions

dist1ll
4pts0
alic.dev 2y ago

Memory-efficient enum arrays in Zig

dist1ll
322pts239
github.com 2y ago

Material for MkDocs – Documentation that simply works

dist1ll
1pts0
lemire.me 3y ago

Counting cycles and instructions on ARM-based Apple systems

dist1ll
2pts0
sneller.io 3y ago

Sneller Regex vs Ripgrep

dist1ll
4pts3
gynvael.coldwind.pl 3y ago

Hello World Under the Microscope

dist1ll
2pts0
alic.dev 3y ago

On Custom-Width Integer Types

dist1ll
4pts0
futhark-lang.org 3y ago

On Nontermination and Optimisation in Futhark

dist1ll
4pts0
gamozolabs.github.io 3y ago

Sushi Roll: A CPU research kernel for micro-architectural introspection (2019)

dist1ll
1pts0
erpc.io 3y ago

eRPC: A fast remote procedure call library for datacenters

dist1ll
2pts0
arstechnica.com 3y ago

Understanding Bandwidth and Latency (2002)

dist1ll
3pts0
alic.dev 3y ago

Measuring the Impact of False Sharing

dist1ll
1pts0
adrianchadd.blogspot.com 3y ago

Intel DDIO, LLC cache, prefetching, shared locks and packet rates (2015)

dist1ll
1pts0
7-cpu.com 3y ago

7-Zip LZMA Benchmark

dist1ll
2pts0
news.ycombinator.com 3y ago

Ask HN: Measuring performance of binary code layout

dist1ll
2pts2
mikiltaylor.com 3y ago

In Violent Agreement

dist1ll
2pts0
alic.dev 3y ago

Avoiding benchmarking pitfalls with black_box in Rust

dist1ll
1pts0
www.brendangregg.com 3y ago

An Unbelievable Demo

dist1ll
3pts1
www.agner.org 3y ago

Optimizing Assembly – Agner Fog [pdf]

dist1ll
28pts2
alic.dev 3y ago

Renaming Our Company Revealed a Critical Bug

dist1ll
2pts0
alic.dev 3y ago

Comparing Yourself to Others Is Fine

dist1ll
2pts0
news.ycombinator.com 4y ago

Ask HN: Has anyone used Coz for casual profiling?

dist1ll
1pts0
www.youtube.com 4y ago

Bill Gates Explains the Internet to Letterman (1995)

dist1ll
1pts0

The Aurora paper [0] goes into detail of correlated failures.

In Aurora, we have chosen a design point of tolerating (a) losing an entire AZ and one additional node (AZ+1) without losing data, and (b) losing an entire AZ without impacting the ability to write data. [..] With such a model, we can (a) lose a single AZ and one additional node (a failure of 3 nodes) without losing read availability, and (b) lose any two nodes, including a single AZ failure and maintain write availability.

As for why this can be considered durable enough, section 2.2 gives an argument based on their MTTR (mean time to repair) of storage segments

We would need to see two such failures in the same 10 second window plus a failure of an AZ not containing either of these two independent failures to lose quorum. At our observed failure rates, that’s sufficiently unlikely, even for the number of databases we manage for our customers.

[0] https://pages.cs.wisc.edu/~yxy/cs764-f20/papers/aurora-sigmo...

"surely if I send request to 5 nodes some of that will land on disk in reasonably near future?"

That would be asynchronous replication. But IIUC the author is instead advocating for a distributed log with synchronous quorum writes.

As long as your target language has a strict define-before-use rule and no advanced inference is required you will know the types of expressions, and can perform type-based optimizations. You can also do constant folding and (very rudimentary) inlining. But the best optimizations are done on IRs, which you don't have access to in an old-school single pass design. LICM, CSE, GVN, DCE, and all the countless loop opts are not available to you. You'll also spill to memory a lot, because you can't run a decent regalloc in a single pass.

I'm actually a big fan a function-by-function dual-pass compilation. You generate IR from the parser in one pass, and do codegen right after. Most intermediate state is thrown out (including the AST, for non-polymorphic functions) and you move on to the next function. This give you an extremely fast data-oriented baseline compiler with reasonable codegen (much better than something like tcc).

Why xor eax, eax? 8 months ago

Another one is "jalr x0, imm(x0)", which turns an indirect branch into a direct jump to address "imm" in a single instruction w/o clobbering a register. Pretty neat.

I do use a combination of newtyped indices + singleton arenas for data structures that only grow (like the AST). But for the IR, being able to remove nodes from the graph is very important. So phantom typing wouldn't work in that case.

Sure, these days I'm mostly working on a few compilers. Let's say I want to make a fixed-size SSA IR. Each instruction has an opcode and two operands (which are essentially pointers to other instructions). The IR is populated in one phase, and then lowered in the next. During lowering I run a few peephole and code motion optimizations on the IR, and then do regalloc + asm codegen. During that pass the IR is mutated and indices are invalidated/updated. The important thing is that this phase is extremely performance-critical.

If that's the case then hats off. What you're describing is definitely not what I've seen in practice. In fact, I don't think I've ever seen a crate or production codebase that documents infallibility of every single slice access. Even security-critical cryptography crates that passed audits don't do that. Personally, I found it quite hard to avoid indexing for graph-heavy code, so I'm always on the lookout for interesting ways to enforce access safety. If you have some code to share that would be very interesting.

For iteration, yes. But there's other cases, like any time you have to deal with lots of linked data structures. If you need high performance, chances are that you'll have to use an index+arena strategy. They're also common in mathematical codebases.

every unwrap in production code needs an INFALLIBILITY comment. clippy::unwrap_used can enforce this.

How about indexing into a slice/map/vec? Should every `foo[i]` have an infallibility comment? Because they're essentially `get(i).unwrap()`.

WASM 3.0 Completed 10 months ago

WASM traps on out-of-bounds accesses (including overflow). Masking addresses would hide that.

because that is what it means in mathematics

Personally, I think this argument only holds water for languages that are rooted in mathematics (e.g. Haskell, Lean, Rocq, F*, ...). If your computational model comes from a place of physical hardware, instructions, registers, memory etc. you're going to end up with something very different than an abstract machine based on lambda calculus. Both valid ways to design a PL.

Intel still does it. As far as I can see they're the only player in town that provide open, detailed documentation for their high-speed NICs [0]. You can actually write a driver for their 100Gb cards from scratch using their datasheet. Most other vendors would either (1) ignore you, (2) make you sign an NDA or (3) refer you to their poorly documented Linux/BSD driver.

Not sure what the situation is for other hardware like NVMe SSDs.

[0] 2750 page datasheet for the e810 Ethernet controller https://www.intel.com/content/www/us/en/content-details/6138...

While latency from a conventional CDN is usually < 80ms, with Cloudflare, I have frequently seen it to be in 150-300ms

So since magecdn is built on top of Cloudflare, how do they guarantee low latency?

Fast 12 months ago

It's fascinating to me how the values and priorities of a project's leaders affect the community and its dominant narrative. I always wondered how it was possible for so many people in the Rust community to share such a strong view on soundness, undefined behavior, thread safety etc. I think it's because people driving the project were actively shaping the culture.

Meanwhile, compiler performance just didn't have a strong advocate with the right vision of what could be done. At least that's my read on the situation.

You can get pretty far with a branch per byte, as long as the bulk of the work is done w/ SIMD (like character classification). But yeah, LUT lookup per byte is not recommended.

OP works for Red Hat, and some of the tests require booting systems with 64k pages.

What surprises me more is why Red Hat doesn't provide them with the proper hardware..

Language design can have massive impact on compiler architecture. A language with strict define-before-use and DAG modules has the potential to blow every major compiler out of the water in terms of compile times. ASTs, type checking, code generation, optimization passes, IR design, linking can all be significantly impacted by this language design choice.

True. I'm guessing it's the same reason that lexing and parsing are the focus of many langdev guides, despite being amongst the smallest/simplest parts of the compiler. I guess it makes sense, since those topics are the entry point into the field and at some point your learning is mostly self-directed.

150k rows/second is pretty ordinary if you do batching, especially for a machine of that size. I was able to get 250k+ row inserts on a 16vCPU on a table with 16 columns, a third of which are strings >30 bytes. Pretty sure you can push that much higher with COPY.

Dealing with references you typically find in a compiler is not a problem for Rust. Arena allocation and indices are your friend.

64000x($100+256x$4)=$7,193,600 worst case pricing

Not sure how you arrived at this calculation. 256x$4 already accounts for 256GB. The database in the OP is 6400GB large. So shouldn't it be 25x($100+256x$4) = $28100?

FWIW in practice this number should be much, MUCH lower. You can get 1TB of ECC DDR4 for ~$2k, probably lower if you buy wholesale.

It's possible to build languages that compile faster than Go, with a much more expressive type system.

It's just that compile times and DevEx haven't been a priority for most projects.