Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
attractivechaos
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
10 ms
·
61.
▲
by
attractivechaos
3y ago
If I am right, in C, it is not possible to implement fast type-safe generic algorithms without stuffing everything in headers. libc's qsort can be implemented in a separate .c file but it is a lot slower than std::sort as a result.
62.
▲
by
attractivechaos
3y ago
I dislike CommonJS for a different reason: questionable "fs" module. This module mixes file I/O with file system accesses, which is confusing. More importantly, it does not provide line reading in a synchronous way. I sometim
63.
▲
by
attractivechaos
3y ago
> the [std::unordered_map] hash map needs 1 malloc() call per entry. This is a key reason why std::unordered_map is several times slower than fast hashmap implementations that only use a couple of long flat arrays per hashmap object. N
64.
▲
by
attractivechaos
3y ago
std::unordered_map is notoriously slow, several times slower than a fast hashmap implementation like Google's absl or Martin's robin-hood-hashing [1]. In addition, your implementation lets the hashmap grow from a small size. As yo
65.
▲
by
attractivechaos
3y ago
In my experience, if I underpay my tax, they will come at me and demand penalty and interest. If I overpay my tax, they will do nothing. This is by design, I think.
66.
▲
by
attractivechaos
3y ago
A catch in Knuth's famous quote is how to define "premature". I am not old enough to see how programmers in his time thought about "premature", but my impression is quite a few modern programmers think all optimizat
67.
▲
by
attractivechaos
3y ago
At least in glibc, the printf family is much slower than strcpy. It is a huge performance penalty if string copy is frequent (e.g. when you incrementally write to a large string buffer).
68.
▲
by
attractivechaos
4y ago
> they need product managers who understand the underlying technology and can commercialize it. I would say they more need engineers who care about and can make good products. In my limited experience, it takes time to turn a research-
69.
▲
by
attractivechaos
4y ago
I tried rpmalloc in my application ~5 years ago. For the particular malloc pattern in my code, rpmalloc was much slower than glibc, musl and jremalloc. Tcmalloc was the fastest IIRC, but it had large overhead on memory. My reflection was th
70.
▲
by
attractivechaos
4y ago
The blog post is effectively implementing memmem() or strstr() that searches a short string in a long string. If we are allowed to use GNU extensions, the cleanest solution is to call memmem(). Without memmem(), I would implement Boyer–Moor
71.
▲
by
attractivechaos
4y ago
Many CEOs have their preferences but their preferences may not be shared by their customers (e.g. metaverse). In my view, Steve Jobs was different in that a) his "taste" was deeply shared by targeted customers and more importantly
72.
▲
by
attractivechaos
4y ago
> especially on the memory management side. Libc string functions don't manage memory. They can be used no matter where your strings are stored. It is more of a choice between generality vs convenience in common cases.
73.
▲
by
attractivechaos
4y ago
I wish all software could provide portable binaries. However, compiling portable binaries is hard. Not many developers have the skill.
74.
▲
by
attractivechaos
4y ago
Curl 2000 was the best to me.
75.
▲
by
attractivechaos
4y ago
> That's basically a side-effect of Perl being a dead language Keeping long-term backward compatibility does not necessarily mean dying. C is 50 years old and still alive. I have written a lot more Perl than Python. IMHO, Perl is
76.
▲
by
attractivechaos
4y ago
Both are very impressive. A nice thing about Gerganov's implementation is that it is written in almost pure C. Arguably easier for deployment.
77.
▲
by
attractivechaos
4y ago
You quoted "classical music aficionados". I was mainly reacting to that part and explaining what an aficionado would do. A random person buying a Big Mac is not an aficionado. Also from the article, 2.5% paid, 0.6% listened and 0.
78.
▲
by
attractivechaos
4y ago
Concert soloists have their own characteristics. They often play the same piece with subtle differences and confer different feelings. Some may sound more convincing/touching than others. When I hear a version I like, I may check who i
79.
▲
by
attractivechaos
4y ago
Fair enough. For the relatively few tools that don’t support streaming, you may generate temporary plain files in your pipeline. Spades itself is a pipeline and writes temporary files. It is anyway not realistic to expect wide adoption of z
80.
▲
by
attractivechaos
4y ago
For compressing similar genomes, specialized tools will do better. AGC [1] can compress 620k SARS-CoV-2 genomes (19 GB uncompressed) into tens of MB. More importantly , AGC allows you to extract individual sequences without decompressing t
81.
▲
by
attractivechaos
4y ago
The webpage in the title is pretty good. It explains most things you need to achieve OOP in C. This PDF however pushes C for what it is not intended for, which leads to inefficient and obscure code. For example, the first example in the PDF
82.
▲
by
attractivechaos
4y ago
I don't like C++ but even C++ would be a better choice than the GObject system IMO. GObject is abusing C for what C is not designed for. The result is an inefficient and complex system that makes C++98 look simpler.
83.
▲
by
attractivechaos
4y ago
Interesting! Thank you for maintaining the benchmark all these years.
84.
▲
by
attractivechaos
4y ago
I am not familiar with Advent of Code. If all their problems take ~0.1s to solve in C, you are probably right. However, it is a stretch to make a high-level conclusion just based on small exercises, like this: > There was never a time w
85.
▲
by
attractivechaos
4y ago
> compilation versus interpretation never made a sigificant difference in performance for my solutions (which tended to be dominated by algorithmic complexity concerns) ... Were I to implement a language, I think I’d favor having an int
86.
▲
by
attractivechaos
4y ago
Nice blog post. Nonetheless, to a new learner like me, the hardest part of rust is not its syntax; it is the ownership management. Sometimes I easily know how to implement a task efficiently in other languages but I have to fight the compil
87.
▲
by
attractivechaos
4y ago
The Linux kernel comes with many old drivers that modern programmers have little knowledge about. It is probably more realistic to write a new kernel in rust (like Redox), targeting modern machines only.
88.
▲
by
attractivechaos
4y ago
The printf() family is much slower than direct string operations. snprintf() is not a good substitution when string copying is frequent.
89.
▲
by
attractivechaos
4y ago
Atomic is one of the few things in C11 I like most. Unfortunately, it is an optional feature along with threading [1]. It is not portable. In the end, I am still using gcc/clang's __sync or __atomic builtins. [1] https:/
90.
▲
by
attractivechaos
4y ago
Difficult but possible. For example, Robert Edgar [1] works alone and is one of the most productive developers in this field. [1] http://drive5.com
More ›