QuarticCat’s Blog

> Welcome_

No more OOM in C/C++/Rust builds

I’ve seen people complaining about some gigantic C/C++/Rust projects engulfing all of their memory during building from time to time. Fortunately, there are a few simple methods to alleviate the pain without sacrificing speed. By “simple,” I mean you don’t have to modify your code! Root of the problem Usually, the most memory-consuming part of C/C++/Rust builds is the linking phase. To link object files, the linker must read all of them into memory....

July 2, 2024 · QuarticCat

Some useful Zsh key-bindings

Built-in undo & redo No need to explain. They work as their name suggest. Many Zsh users remain unaware of these two widgets since they are not bound in viins keymap (which is the default for most users). I bind them to [Ctrl+Z] & [Ctrl+Y], respectively. magic-space It behaves like normal space except that it can perform history expansion. That is to say, it turns !-1 to <last command> in your buffer....

March 12, 2024 · QuarticCat

How do I boost difftastic by 4x

Difftastic is a structural diff that understands syntax. The diff results it generates are very fancy, but its performance is poor, and it consumes a lot of memory. Recently, I boosted it by 4x while using only 23% of memory (#393, #395, #401). This post explains how I accomplished this. Hope it can bring you some inspiration. When I started to write this post, not all optimizations were reviewed and merged....

October 6, 2022 · QuarticCat

RVV may not be as good as you think

As an emerging ISA, RISC-V learns a lot from its predecessors’ mistakes and brings some very appealing designs. In my circles, RISC-V is frequently associated with the words “modern” and “elegant”. Its vector extension (RVV) is often given equivalent praise, even though nearly no one has used a real-world RVV machine (including me) or even programmed in RVV. After experimenting with RVV for a while, I feel that it is not as good as many people claimed....

February 27, 2022 · QuarticCat

One more nasty design of C++'s name lookup

As we all know that C++’s name lookup has always been extremely counter-intuitive. The infamous argument-dependent lookup (ADL), for example, often leads to unexpected behavior and, worse yet, is often difficult to troubleshoot. This can happen when you define a function in your current namespace, but when you call it the compiler selects another function with the same name thousands of miles away, even though you did not using that foreign function in the current namespace....

June 23, 2021 · QuarticCat