ncruces

Joined 3 years ago

Karma
2,550
Submissions
1,123
Member since
May 25
https://github.com/ncruces
View on Hacker News

Recent submissions

Comment · 9 hours ago
I have a digital Casio with an analog display. It's solar, so it never needs to be charged. It sets itself to the correct time, and date, across DST and timezone changes.

It doesn't have the mechanical beauty of an automatic with a perpetual calendar, but is otherwise better in every way that matters, and it is just as pretty.

Comment · 2 days ago
People who are already using it (both internally and/or select partners) can speak more freely about it if it's announced.

This is especially true around earnings, not necessarily for some sinister reason, other than it's material information that can influence the market.

Comment · 2 days ago
I personally found balancing weight balanced trees pretty straightforward: https://yoichihirai.com/bst.pdf

What I like about immutable treaps is that, if you using hashing rather than randomness, you can achieve O(1) equality for entire trees.

Unfortunately, my current language of choice makes hash consing too slow.

Comment · 2 days ago
And much better for not going into needless detail.

In fact, a problem with LLMs is that they consistently write more than I want to read.

Comment · 3 days ago
But then you increase the risk of (suspected) sabotage disrupting the Dutch railway network. Which obviously is better than an deadly accident, but...
Comment · 6 days ago
Dead people not removed from the registry?
Comment · 7 days ago
80h ago everyone was advising everyone else to take all their websites immediately down.

Now it's only worth it to hack a website that's asking to be hacked if the prize is $15k.

Comment · 8 days ago
Did they ask Claude "don't cheat" this time round?
Comment · 10 days ago
Comment · 14 days ago
Already superceded by 3.54.1, mostly due to a memory corruption issue on 32-bit builds.

I'm still holding on releasing my Go bindings on another just uncovered performance bug.

It's honestly been the most unstable .0 release I remember. If this is what a frenzy to fix LLM reported bugs causes to a well established project, I don't know what the future holds.

Comment · 15 days ago
This is very cool.

SQLite uses the "streaming" push/pop/eval API for windowed aggregates.

DuckDB implements "segment tree aggregation" by swapping "combine" for "pop".

This means I can offer an adapter that turns combinable aggregates into invertible aggregates, in amortized O(1).

Comment · 18 days ago
> In computer science, the median of medians is an approximate median selection algorithm, frequently used to supply a good pivot for an exact selection algorithm, most commonly quickselect…

https://en.wikipedia.org/wiki/Median_of_medians

That's pretty much what I posted: median-of-ninthers is an evolution of median-of-medians, that I use to pick a better pivot whenever the pivot supplied by median-of-3 turns out to be bad.

Using it all the time would simply make quicksort/quickselect about twice as slow as it is now, but still faster than heapsort/heapselect. It's a better backstop algorithm than the common introsort/introselect.

There's also no randomisation, the implementation is completely deterministic, and depends exclusively on the input order.

And median-of-ninthers is faster, but median-of-medians is far from terrible, so calling it a galactic algorithm or completely useless in practice is far from the truth, IMO.

Comment · 18 days ago
I do. I had it listed in my own README as an alternative for a long, long time, and both show up in these often posted benchmarks: https://github.com/cvilsmeier/go-sqlite-bench

But for the point I was making, it is in fact not an alternative. In my version each SQLite connection is confined to a sandbox, and a C memory bug cannot corrupt the Go runtime, call stack or heap. In their version, a C pointer becomes an unsafe.Pointer that can address all Go memory.

Comment · 18 days ago
> "median of medians" (finding the median in a list in O(n) worst-case time) is useless because it is not used in practice.

This one is just not true. Here it is in 255 lines of well commented Go code: https://github.com/ncruces/sort/blob/v1.0.3/quick/quick.go

It's worse case linear, as used for sorting it beats the Go standard library on the average and worst cases, lagging a bit on the best cases.

In my experience, median-on-ninthers (which is only slightly more complicated than median-of-medians) definitely beats both heap sort and particularly heap select as a fall back for the degenerate case.

And it's not just academic: I've sped up significant stuff at work by switching from sorting to partial sorting and/or selection.

Comment · 19 days ago
Shameless plug: if you value Go, and CGO_ENABLED=0, and SQLite, and are worried about C in a web server and RCEs, may I interest you in my SQLite driver?

https://github.com/ncruces/go-sqlite3

I just wrote up the security goals of the tool I use to translate C to Go: https://github.com/ncruces/wasm2go/blob/main/SECURITY.md

I obviously can't make any promises, as it's just a personal pet project, but those are the goals, and they do catch memory corruption bugs in practice: https://sqlite.org/bugs/forumpost/543f94984b

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton