420 karma · joined Aug 24, 2023 (3y ago) · 456 submissions
Probably busy doing data processing at any given moment.
comment 1d ago · link · parent
Many people program for their hardware (what else can be actually tested) or maybe qemu or virtualbox or vmware or a specific external microcontroller.
Very few people want to program for the C abstract machine. The C abstract machine doesn’t even really have dlopen(3). It also has to be compatible with Harvard architecture, von Neumann architecture, two's complement signed machine word integers, one's complement signed machine word integers, and sign-magnitude signed machine word integers.
comment 1d ago · link · parent
1. The craft of writing effectively
https://www.youtube.com/watch?v=vtIzMaLkCaM
2. Writing beyond the academy
https://www.youtube.com/watch?v=aFwVf5a3pZM
EDIT: Despite the names, both videos are good for practical examples and many seemingly unrelated use-cases.
comment 1d ago · link · parent
Or strange issues with optimizing infinite loops and the Halting problem preventing a full automated solution.
The C compilers like GCC just hide stuff away and break things silently.
comment 1d ago · link · parent
x86_64 is useful and widespread maybe because it is so easy to use like pointers are just integers and because the IBM PC was cheap back in the day and still is affordable today. And backwards compatibility just like Java.
Itanium was not backwards compatible and died almost immediately.
For better or for worse, C tries to run on all kinds of hardware that is obscure today. Like one's complement or sign-magnitude integers. This is why no C or C++ library will ever have decent bounds checked arrays.
And back in 1989 it was decided that coming from a PDP-11 and faced with this "anything goes". Until compiler writers used UB to intentionally break SSL, everything looked fine. We are still learning from this.
One problem with overflow safer languages on LLVM is that LLVM IR was originally designed for C++ and some NULL pointer UB weirdness or signed overflow weirdness specific to C was baked into LLVM's IR at the lowest level.
As long as we do this it will be horrible. No escape hatch to sane behaviour. Except for people to skip all the UB by writing assembly for random proprietary microcontrollers.
comment 1d ago · link · parent
Feels a little like Harvard architecture says there is not global axiom of choice and von Neuman architecture and single tape Turing machines explicitly count everything in the same memory (except for the logic in the Turing machine control head.)
comment 1d ago · link · parent
So, mathematically, pointers still are integers, because "everything" can be encoded as a natural number. Handles like in Windows or UEFI, hardware descriptors like internal to netmap and io_uring for NIC physical memory mapped control registers, 32-bit integer page numbers within sqlite databases, or memory addresses in x86_64 registers. Tagged numbers for counting stuff. Just look at off_t in Linux. Or unix filesescriptor fd numbers into a tiny per-process table of each Linux process. Some with hardware support, some without.
And then stuff like ptrdiff_t in the C abstract machine.
All the same idea. And it "only works", because they are "just numbers".
And then come the implementation details.
comment 1d ago · link · parent
With a reverse B-tree heap it may be fruitful to prefetch a back offset from the end of the file that ends with the top of the heap inclusive and then switch to random single reads for the sparser read access "down" the heap towards the beginning of the file.
Then comes the question of write access. Flash storage seems to be able to write small read-sized sectors into the empty remainders of erase blocks. With SMR the question becomes, whether there is a third sector size like a single track layer where the next overlapping track can be written later. For erasing, the whole shingle needs to be replaced kind of like a flash erase block.
Maybe OpenZFS ashift can be adjusted to single track sizes within a shingle. That would curb write amplification to the physical limitations. At 60 to 150 tracks that still requires ashift between roughly 22 and 20.5 which are both larger than 16. Seems like it is especially bad if there are no common divisors or other rounding problems.
Maybe non-temporal writes and write coalescing like in CPUs become relevant now. Dan Luu seems to be right here. The read(2), write(2), and fsync(2) bedrock of Unix may be forced to be updated to CPU-like caches where barriers, write-backs, etc. are handled separately.
Land of contrasts, even compared to usual engineering trade offs.
comment 1d ago · link · parent
What is the problem with having a <div> on z-layer above a <canvas> and just absolute positioning them on top of each other and making them the same size on screen?
I liked <canvas> even more, when I thought that NodeJS supported it. Then I learned that they prefer doing stuff like using libpng. Ah well. At least we can look forward to plv8 growing a third way to do it. Variety vibes and all that jazz.
comment 1d ago · link · parent
Nice and fast like typing into 8-bit BASIC.
And today the CPU is fast , too.
80x25 doesn’t need too much of a GPU, which avoids long 300ms PCIe network operations.
Low latency is King.
EDIT: typo
comment 2d ago · link · parent
If we take a new hard look at open(2), read(2), and write(2), then let us look at real-world use cases. (Yes, yes, distributed systems. But the demand for at least decent errors is real.)
comment 2d ago · link · parent
Functional analysis looks at Moore-Smith sequences a.k.a. nets when dealing with countable infinity versus uncountable infinity.
In measure theory, there is currently no good generalization of Vitali's counter-example to (countably) infinite vector spaces.
comment 2d ago · link · parent
Shouldn't this be especially useful with ZFS doing copy-on-write with linked lists as a reversed heap?
EDIT: So apparently, ZFS ashift is capped at 16 and values along 28 would be necessary to cover entire 256MiB (octet) shingles. Bummer.
EDIT2: The basic problem seems to stem from the exact same assumption that SQLite3 [1] makes: The sector write size for random write access is 512B or 4KiB, or whatever. With SMR and flash erase blocks, random write sector size and random read sector size are vastly different. Will take ages for filesystems to be updated to this new reality and then validated on real workloads.
[1] https://www.sqlite.org/atomiccommit.html, section 2 Hardware Assumptions.
comment 3d ago · link · parent
Load an entire Chrome V8 or NodeJS V8 into Postgres to have JS pg modules.
JS now runs on phones, on web servers, and inside your postgres relational database. Add Mongo and vibe code JS for redis or memcached for bonus internet points.
If Rust is rewritten in JS, then Bun can finally return to its roots.
END half satire (plv8 is real, though)
comment 3d ago · link · parent
Hylang also had a good take on anaphoric macros in relation to threading macros. Clojure makes it more obvious that explicitly passing in the anaphoric symbol at the call-site is better for maintainability. This offers threading with arbitrary argument positions instead of forcing first or last position.
Clojure transducers finally broke the ice on common lisp series. The CL side of this is horrifying. SBCL seems to have dropped its sb-series contrib module. But it moved us far enough along that we now have parenscript-series. So upside all around.
Don’t know enough Fennel (Lua) or Elixir (Erlang) yet, to have any useful comments there.
comment 3d ago · link · parent
Clojure is a lisp-1 which, surprisingly, feels better to use than a lisp-2. Much more intuitive. (You can kind of also have a function call returning a function in the first position of a list and it just works. Common Lisp doesn’t like that at all and you need funcall or apply.)
The immutable data structures and better array and hashmap syntax and ergonomic hashmap argument destructuring remove a lot of mental overhead. Kind of like Python or JSON-in-Javascript.
Having slight syntax variation like square brackets for let bindings and one less level of nesting in let bindings makes it easier to read. Still homoiconic, though. So you get the best of both worlds.
The hygenic macros helped me design better anaphoric macros.
EDIT: typo
comment 4d ago · link · parent
Turning off smt (and nohz_full; it’s not a network server) lets the cores clock down cleanly. Got that trick from the intel manual and learned about clock domains from a Verilog programmer. Has worked reliably on many Linux systems.
Even found that one of my i5 servers never had smt to begin with, which explained its more consistent performance.
Had been poking at this for at least 5 years prior with powertop(8) to no avail.
EDIT: nosmt also effectivle doubles ram cache size. For my work the extra hyperthrrad is useless, because there are rarely mixed processes where some to integers and the others do floats. Bottlenecked on ALU and cache, mostly matrix stuff.