Better HN
topnewbestaskshowjobs
Log inSign up

dapperdrake

420 karma · joined Aug 24, 2023 (3y ago) · 456 submissions

Blog: https://dapperdrake.neocities.org

Probably busy doing data processing at any given moment.

Submissions

comment 22h ago · link · parent

Little downside. High upside.

comment 1d ago · link · parent

We seem to agree.

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

Matrix derivatives

comment 1d ago · link · parent

Or Radon-Nikodym for measurable functions.

comment 1d ago · link · parent

3SAT, Travelling salesman problem, knapsack problem

Even just for better gpu scheduling of AI workloads. Worth a shot for getting directly compounding results.

comment 1d ago · link · parent

Was it ever necessary?

comment 1d ago · link · parent

My bad.

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

More like code that falls through might be reordered in the binary and the C abstract machine has no concept of that.

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

C abstract machine is from 1989 and also wants to be compatible with machines like a VAX or microcontrollers with Harvard architecture from back then.

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

When you want to support something like Harvard architecture with functions in ROM and data in RAM.

comment 1d ago · link · parent

There are also Harvard architecture machines like microcontrollers where a function pointer points to ROM and a data pointer points to RAM.

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

There was an old VAX or something that had a C standard library where function pointers in both C and Fortran were multiple machine words. C was 4 words and Fortran was 6 with everything but the first two being reserved for later. The idea was to provide additional argument and return type information in tag bits in the additional machine words.

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

Clojure is less pleasant to use for "one-off" standalone shell scripts than sbcl, because of the JVM's startup latency. During manual testing and problem exploration this matters more than anything else.

TCC even has a —script mode for C.

comment 1d ago · link · parent

Erlang BEAM VM

comment 1d ago · link · parent

Maybe Donald Knuth should keep the paper foldout on tape access patterns in TAOCP instead of removing it in the next revision as he mentioned in an interview somewhere. The problem domain seems to be resurfacing.

comment 1d ago · link · parent

It seems like posix_fadvise a.k.a. fcntl only has provisions for forward read ahead a.k.a. prefetching and random access. The latter disables prefetching to free up disk read operations and dram memory otherwise used for read ahead.

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

console.log("Finally.")

comment 1d ago · link · parent

This is probably me lacking imagination:

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

Some terminal emulators are still simpler with less data in ram and therefore higher cpu cache residency.

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

Larry McEnerney has two excellent videos about how to make written text readable. Iterate on it a.k.a. editing until it goes with the grain of the reader rather than the grain of the writer. Worth re-watching.

comment 2d ago · link · parent

While we are at it, let us also redesign the important application of NFS. The actual implementation of NFS seems to have, ummm..., impedance mismatches for a lot of people using it casually in university computer networks and SLURM clusters.

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

See also: Lean grind.

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

How come copy-on-write is not easier with SMR? Each SMR zone a.k.a. shingle or flash erase block is effectively a tiny tape drive. It is basically append only.

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 2d ago · link · parent

It’s called hygienic macros. Has to do with details around symbol capture. Idea originated in scheme, IIRC.

All those approaches are "full" lisp macros. You have all of lisp or clojure or scheme available at macroexpansion time.

comment 3d ago · link · parent

Then you will love plv8.

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.

https://github.com/plv8/plv8

END half satire (plv8 is real, though)

comment 3d ago · link · parent

Clojure and hylang (python) help with understanding threading macros (-> …), so basically more readable shell pipelines.

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

A little bit.

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

Depending on what you are going for you may want to add nohz_full,nosmt to your Linux grub kernel command line arguments and set noatime on ext4 filesystems in file /etc/fstab.

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.

comment 4d ago · link · parent

The frostbite tiles and their work-stealing is reminiscent of a 2d-grid of basic blocks from compiler design. Register renaming or something similar to it also seems to help building intuition about this.

comment 4d ago · link · parent

Arrays in bash are … messy.
12345
16