btdu - a sampling disk usage profiler for btrfs (written in D)

Vladimir Panteleev thecybershadow.lists at
Sun Nov 8 17:23:32 UTC 2020

D-related thoughts:

- D programs that build fine on one Linux machine may still fail 
to build with mysterious linking errors on another, even when 
using Dub which takes care of dependency management. I saw two 
counts of this, caused by differences in DMD/LDC and Arch/Debian 
(one being that, for whatever reason, libz is not pulled in on 
LDC/Debian despite being a Phobos dependency). Also, LDC is the D 
compiler that's installed by default when the system wants a D 
compiler (e.g. if you try do install Dub by itself).

- The garbage collector is still a major hindrance for system 
programming. In this case it was due to the ioctls used being 
slow, and when the GC tries to stop the world to do its thing, it 
just hangs the entire program until ALL ioctls in all threads 
complete. This means it wasn't possible to have a stutter-free 
interactive UI, so I had to move processing to subprocesses.

- One user wondered why the program needed so many threads. The 
answer was that half of them were owned by the GC (it never stops 
its worker threads, they just sit idle).

- I used the Deimos ncurses bindings package. I'm thankful that 
it already existed, though I had to push some fixes to fix static 
linking. The most annoying part was waiting overnight for to pick up the new tags, because there is no way 
to get it to update a package unless you're the owner, and no way 
to otherwise specify a dependency unless using a branch (which is 
deprecated and prints a big warning when your users build your 

- Nice D features that came in useful: reflection to generate a 
lightweight serializer/deserializer for subprocess communication; 
strings as slices to allow processing them without copying them 
out of the network buffer; and template mixins to add common 
behavior to types without runtime polymorphism.

More information about the Digitalmars-d mailing list