Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ludocode
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
17 ms
·
121.
▲
by
ludocode
6y ago
This article doesn't really make it clear but the merge sort discussion is specifically about glibc's implementation of qsort(). glibc's qsort() and Wine's qsort() are the only ones I know of that use merge sort to imple
122.
▲
by
ludocode
6y ago
Hi HN, this is a new implementation of the standard C qsort() function. It's faster than all other libc qsort() functions at least in my simple benchmarks. The implementation is similar to the classic quicksort with three-way partition
123.
▲
Show HN: qsort() with size specializations, faster than all current libc qsorts
(github.com)
1 points
by
ludocode
6y ago
|
1 comments
124.
▲
by
ludocode
6y ago
That library is included in Pottery's benchmarks! :) It's another of the very few C libraries that use the #include template style. Pottery's intro_sort has comparable or better performance to swenson's quick_sort but wi
125.
▲
by
ludocode
6y ago
This is true, but your second point is difficult to do in C. You would have to have a set template and a separate lookup template to search the set based on a key type. This is actually how heterogeneous lookup is implemented in C++: it
126.
▲
by
ludocode
6y ago
It appears you are technically correct. TIL! I don't think it matters in this benchmark though. Compilers can certainly deduce that it's a compile-time constant because the template is fully instantiated in the same translation un
127.
▲
by
ludocode
6y ago
I don't believe this is correct. Passing a function name to a C++ template doesn't mean it will be called by an indirection at runtime. The compare function will certainly be inlined. Wrapping it in a lambda is useless and would a
128.
▲
by
ludocode
6y ago
I've had the opposite complaints on my similar but verbose library. Some want short names and some want full explicit names. I'm not sure which way is more popular. Paul Graham has mentioned in several essays how programmers are l
129.
▲
by
ludocode
6y ago
Might as well plug mine too: https://github.com/ludocode/pottery I'm not really sure what makes a project take off on HN. I posted mine here a couple weeks ago and got one single upvote :(. I'm glad to see th
130.
▲
by
ludocode
6y ago
> Cosmopolitan only depends on stable kernel ABIs with long term stability promises Unfortunately, on macOS a stable kernel ABI does not exist. macOS has had kernel ABI breakage before, even recently, and they explicitly warn against mak
131.
▲
by
ludocode
6y ago
I wrote a toy chess engine a few weeks ago as well as an example for one of my open source libraries [1]. I was inspired by a video of someone writing one in half an hour [2], so I also assumed it would take a day or two at most. It took mo
132.
▲
by
ludocode
6y ago
I think it's more that bad programmers focus on surface details like code style. All too often I've seen a code review of a complex feature get derailed by nitpicking of inconsequential things like variable names, formatting, etc.
133.
▲
by
ludocode
6y ago
> They simply needed more time. They needed more games, not more time. People forget that there are over a dozen games and expansion packs that make up the Grand Theft Auto franchise. They didn't just make GTA5 in a vacuum. They had
134.
▲
by
ludocode
6y ago
Not really. I originally used just a P_ prefix instead of POTTERY_ and tried to abbreviate some things (e.g. ITREE/ILIST for intrusive containers, etc.) I found it just made things ambiguous and required remembering more stuff (for exa
135.
▲
by
ludocode
6y ago
Indeed, the person you're replying may have experienced a parse error, but this isn't the same person as the one who claimed it's an oxymoron. Maybe they made that claim because an alternative to Electron probably still uses
136.
▲
by
ludocode
6y ago
They claim to be in the technological pessimism camp. I don't believe their poor support for progressive web apps is truly about privacy and security, but rather to force apps to go through their App Store so they get a cut of the reve
137.
▲
by
ludocode
6y ago
Hi HN, this is a C container library I've been working on for a while. I've spent a long time trying to figure out the best way to make generic containers in C and this is what I've come up with. Most container libraries in C
138.
▲
Show HN: Pottery – A header-only container and algorithm template library in C
(github.com)
2 points
by
ludocode
6y ago
|
3 comments
139.
▲
by
ludocode
6y ago
I never said C's language features are orthogonal. I said they should be. C is far from a perfect language, as your example shows. Look at it from the opposite direction: if x->y didn't exist today, and the billions of lines of
140.
▲
by
ludocode
6y ago
You have accused me of arguing in bad faith twice in one post. This is insulting, not to mention against the HN rules ("assume good faith"). Clearly we disagree on whether a syntax change is minor. But first let me repeat the poin
141.
▲
by
ludocode
6y ago
I think this example demonstrates the opposite of what you intended. Defer doesn't give you anything that you can't already do. In your last four code blocks, you demonstrated three alternate ways to implement the functionality yo
142.
▲
by
ludocode
6y ago
alloca() is not a standard C primitive. It's only an extension, and its purpose is to dynamically allocate memory that is automatically freed. Using a dynamic amount of stack space is dynamic allocation, it's just not on the hea
143.
▲
by
ludocode
6y ago
This is a silly example of course because you don't have to check free() for null; calling free(NULL) is a no-op. In a more realistic case, say some object was handed off so it shouldn't be cleaned up anymore, you can just add a s
144.
▲
by
ludocode
6y ago
I would tend to agree with you. Unfortunately this proposal is for much more than just block scope cleanup. This proposal contains a specification for complete stack unwinding in C. It doesn't just specify defer, but also panic and rec
145.
▲
by
ludocode
6y ago
The activity metric is especially frustrating because it seems to me that the higher quality a project is, the less bugs will be filed, and so the less activity will result. With one of my open source projects I've got to extreme lengt
146.
▲
by
ludocode
6y ago
You can rent a full 42U rack in a colocation center for ~$1500/mo easily. They'll handle all of that stuff, including redundant power and redundant internet. Of course self-hosting on real hardware is not quite as simple or cheap
147.
▲
by
ludocode
6y ago
I believe the opposite is true. Most chess teachers will agree that tactics are much more important than positional advantage for lower level players. For example here's Jeremy Silman talking about it: https://web.archive.or
148.
▲
by
ludocode
6y ago
Cosmic rays are not just photons. A faraday cage is meant to block electromagnetic fields; it won't do anything to stop leptons. In my university labs I remember an experiment where we were detecting cosmic ray muons that would travel
149.
▲
by
ludocode
6y ago
Neat. I spent a while trying to figure out how you simulated a lava lamp before realizing HasciiCam takes a video feed as input, so I assume this is a real lava lamp. Very cool. It said there were -2 watching when I logged off. I'm gue
150.
▲
by
ludocode
6y ago
I'm up in arms about it because it's illegal. Google is using their vast profits from an unrelated market, tracking-based advertising, in order to subsidize their product in this market, that of video-streaming services. This is a
More ›