The best Hacker News stories from All from the past day

Go back

Latest posts:

Tau: Open-source PaaS – A self-hosted Vercel / Netlify / Cloudflare alternative

Tau: Open-source PaaS – A self-hosted Vercel / Netlify / Cloudflare alternative

As an Employee, You Are Disposable (2023)

Free-threaded CPython is ready to experiment with

Free-threaded CPython is ready to experiment with

AT&T says criminals stole phone records of 'nearly all' customers in data breach

AT&T says criminals stole phone records of 'nearly all' customers in data breach

Engineering principles for building financial systems

Show HN: Dut – a fast Linux disk usage calculator

"dut" is a disk usage calculator that I wrote a couple months ago in C. It is multi-threaded, making it one of the fastest such programs. It beats normal "du" in all cases, and beats all other similar programs when Linux's caches are warm (so, not on the first run). I wrote "dut" as a challenge to beat similar programs that I used a lot, namely pdu[1] and dust[2].<p>"dut" displays a tree of the biggest things under your current directory, and it also shows the size of hard-links under each directory as well. The hard-link tallying was inspired by ncdu[3], but I don't like how unintuitive the readout is. Anyone have ideas for a better format?<p>There's installation instructions in the README. dut is a single source file, so you only need to download it and copy-paste the compiler command, and then copy somewhere on your path like /usr/local/bin.<p>I went through a few different approaches writing it, and you can see most of them in the git history. At the core of the program is a datastructure that holds the directories that still need to be traversed, and binary heaps to hold statted files and directories. I had started off using C++ std::queues with mutexes, but the performance was awful, so I took it as a learning opportunity and wrote all the datastructures from scratch. That was the hardest part of the program to get right.<p>These are the other techniques I used to improve performance:<p>* Using fstatat(2) with the parent directory's fd instead of lstat(2) with an absolute path. (10-15% performance increase)<p>* Using statx(2) instead of fstatat. (perf showed fstatat running statx code in the kernel). (10% performance increase)<p>* Using getdents(2) to get directory contents instead of opendir/readdir/closedir. (also around 10%)<p>* Limiting inter-thread communication. I originally had fs-traversal results accumulated in a shared binary heap, but giving each thread a binary-heap and then merging them all at the end was faster.<p>I couldn't find any information online about fstatat and statx being significantly faster than plain old stat, so maybe this info will help someone in the future.<p>[1]: <a href="https://github.com/KSXGitHub/parallel-disk-usage">https://github.com/KSXGitHub/parallel-disk-usage</a><p>[2]: <a href="https://github.com/bootandy/dust">https://github.com/bootandy/dust</a><p>[3]: <a href="https://dev.yorhel.nl/doc/ncdu2" rel="nofollow">https://dev.yorhel.nl/doc/ncdu2</a>, see "Shared Links"

Second factor SMS: Worse than its reputation

Three years in North Korea as a foreigner (2021)

Three years in North Korea as a foreigner (2021)

WebVM is a server-less virtual Linux environment running client-side

WebVM is a server-less virtual Linux environment running client-side

The Typeset of Wall·E (2018)

The Typeset of Wall·E (2018)

Multi-agent chatbot murder mystery

Brian Kernighan on “The Practice of Programming” [video]

Show HN: I made a Note-Taking app for people who keep texting themselves

This project began when I realized that despite trying many fantastic note-taking apps, I often defaulted to dumping notes into chat apps like Slack or iMessage. I wanted to bring that effortless “text yourself” note-taking experience to a dedicated note-taking app.<p>Originally developed as a macOS app, Strflow is now also available for iOS. Strflow is designed to make note-taking as quick and intuitive as possible, centered around a chronological timeline UI.<p>Here are some of its features:<p>* Tag system<p>* Rich editor with text formatting, images, and note linking<p>* Global shortcuts for quick access<p>* Share extension<p>* Encrypted iCloud backup & synchronization (becomes end-to-end encryption if you enable iCloud’s Advanced Data Protection)<p>Hope you find Strflow interesting. I’m happy to answer any questions.<p>## Some implementation details some of you might be interested in:<p>* The app is implemented natively using Swift.<p>* On macOS, it’s based on AppKit, and on iOS, it uses UIKit, with SwiftUI used partially.<p>* The editor intensively utilizes TextKit.<p>* The sync engine is custom-built using CloudKit.

Things I learned while writing an x86 emulator (2013)

< 1 2 3 ... 241 242 243 244 245 ... 896 897 898 >