Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
0xd34df00d
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
Let's run some NFAs (high-performance Haskell)
(0xd34df00d.me)
2 points
by
0xd34df00d
2y ago
|
0 comments
2.
▲
by
0xd34df00d
7y ago
I was mostly curious about how wc handles spaces and whether ignoring non-ascii spaces brings me closer or farther from what wc does. So I focused on that, and this specific printable characters handling didn't caught my eye. On a meta
3.
▲
by
0xd34df00d
7y ago
No worries, that's a natural reaction! > In practice it's unlikely that you find yourself in a situation where you can write code in a high-level language that runs considerably faster than what you could realistically write in
4.
▲
by
0xd34df00d
7y ago
> For reference, I'm referring to the "oops I did it again" part. It's really hard to take that comment as "honours go to GHC authors". Was overly excited when I created the repo after obtaining the first re
5.
▲
by
0xd34df00d
7y ago
This is a great point about handling printable vs non-printable characters that I originally missed when I read wc code. Thank you for pointing this out!
6.
▲
by
0xd34df00d
7y ago
> So until you put in locale handling, alternate line endings, option handling, and error handling, I don't see that your post is at all convincing. That's precisely what the second part would be about. And, if I succeed, IMO,
7.
▲
by
0xd34df00d
7y ago
Me neither. But experience shows that these titles lead to more folks looking at the post, leading to more feedback, leading to better writing/experimenting/etc in the long run. Also, I was trying to make a reverence to the origin
8.
▲
by
0xd34df00d
7y ago
wc was actually slower with LC_ALL=C as opposed to ru_RU.UTF-8 that my system normally runs with (about 10 s against 7.2 s). Which actually raises a good question of whether I should have been comparing with that one — but that'd proba
9.
▲
by
0xd34df00d
7y ago
Those are fairly trivial and well-known optimizations that I did (and I by no means am an expert in writing high-performant code), so all the honors go to GHC authors.
10.
▲
by
0xd34df00d
7y ago
Sup, author here. > Does the Haskell version really do the same thing as the C version? It counts bytes, words and lines and, modulo intended Unicode space handling and unintended bugs, does the same thing. Indeed, it does not count thin