R

ridiculousfish

ridiculousfish.com · Personal blog · on HN since 2008

Programmer ridiculousfish, who wrote Hex Fiend and revived the fish shell, writes on compiler optimizations, division, and performance.

What HN saysCommenters recommend Hex Fiend for opening huge files quickly, note his work on the fish shell, and cite his argument about Rust's range type.
171HN people shared it
115linked it in comments
83stories submitted
4.1Kstory points
7 months agolast shared
2008people per year2026

Most-shared posts

  1. 1
    The Treacherous Optimization (2006)
    35 people · 77 points · first shared 2012 · 7 comments on HN
  2. 2
    Our arrays aren't (2005)
    19 people · 25 points · first shared 2012 · 11 comments on HN
  3. 3
    Will It Optimize? (2010)
    12 people · 289 points · first shared 2011 · 32 comments on HN
  4. 4
  5. 5
    Faster Unsigned Division by Constants (2011)
    11 people · 83 points · first shared 2011 · 26 comments on HN
  6. 6
  7. 7
    Labor of Division (2010)
    9 people · 21 points · first shared 2012 · 3 comments on HN
  8. 8
    Fish: Finally, a command line shell for the 90s
    6 people · 442 points · first shared 2012 · 146 comments on HN
  9. 9
  10. 10
  11. 11
    Blog
    5 people · first shared 2011
  12. 12
    JavaScript's Tricky Rounding (2018)
    4 people · 9 points · first shared 2018 · discussion on HN
  13. 13
    Barrier
    4 people · 6 points · first shared 2012 · discussion on HN
  14. 14
    My least favorite Rust type
    3 people · 381 points · first shared 2020 · 271 comments on HN
  15. 15
    The One Second Dash
    3 people · 142 points · first shared 2016 · 18 comments on HN

What HN people wrote when they linked it

whizzkid · 2017-08-23
Little bit off topic but if you are afraid of opening large files on Mac OS, try Hex Fiend. It will open for example a 6GB database dump in mili-seconds (no joke) and it will let you search anything in it without you waiting. I just tested the memory usage with that 6GB dump file and it only requires 21MB to open that file. I discovered this program while checking who is behind my favorite shell (Fish Shell) :) http://ridiculousfish.com/
pooriaazimi · 2015-05-18
Well, "ridiculous_fish", the guy who sort of revived the fish shell is an engineer on the AppKit team at Apple: http://ridiculousfish.com I remember installing and using fish 4 or 5 years ago; it was not a great experience -- but after he "took over", I switched and couldn't be happier with fish.
mananaysiempre · 2022-11-22
See also “My least favourite Rust type”[1] for an argument that Rust’s (polymorphic) range type should have used inclusive bounds. [1] https://ridiculousfish.com/blog/posts/least-favorite-rust-type.html, discussed two years ago in https://news.ycombinator.com/item?id=24546928
pjscott · 2022-01-03
In my experience there's usually not much speed advantage to be had from assembly unless you have a specific thesis about how you're going to do better than the code that a good compiler would generate; e.g. the article author skipping C runtime setup overhead, or Mike Pall dissecting the ARM implementation of one of the bytecodes in LuaJIT (recommended!): https://www.reddit.com/r/programming/comments/hkzg8/author_of_luajit_e… Unless you can think of something you can do in assembly that a compiler just wouldn't be able to think of, their ability to generate good machine code is really quite impressive: https://ridiculousfish.com/blog/posts/will-it-optimize.html
interroboink · 2021-12-08
Does your SSC concept include things like profile-guided optimization (ie, consuming runtime statistics for some representative sample)? If your program is doing calculations on data read from a CSV, for example, and you happen to know facts about that data that allows you to make a better algorithm (for that data), then I don't see how a compiler would be able to compete. That aside, I am reminded of: https://ridiculousfish.com/blog/posts/old-age-and-treachery.html "grep sells out its worst case (lots of partial matches) to make the best case (few partial matches) go faster"
kccqzy · 2021-07-31
The fact that the Safari result appears to have two linear fits doesn't surprise me at all. Apple has a history of implementing multiple concrete classes for different sizes for the same abstract class. It has been known that NSArray and CFArray will switch the underlying data structure once it grows past a certain size: https://ridiculousfish.com/blog/posts/array.html Now I'm not saying this NSArray trick was what happened here: it clearly is not because otherwise we'd see a quadratic curve followed by a linear curve. I'm just saying the data structure seems to have changed at a certain size cutoff.
ridiculous_fish · 2021-06-09
Angband was the first software I ever released! I loved the game so much, but it was not OS X native. I set out to "carbonize" Angband to run natively, and later I even rewrote it in Cocoa, with better text rendering and other goodies. The Cocoa rewrite got merged as the Mac front end. http://ridiculousfish.com/angband/ https://github.com/angband/angband/pull/64
lifepillar · 2019-10-12
I love the Hex Fiend hex editor [0]! Among the rest, it shows how scrolling should work in all macOS apps (fast, smooth, and precise). [0] https://ridiculousfish.com/hexfiend/
forgotpwtomain · 2017-03-12
HCIdivision17 · 2016-12-16
Old age and treachery will beat youth and skill every time. I love that line. It's featured in a neat writeup by ridiculousfish: http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
losvedir · 2016-09-23
Meh, yet another grep tool.... wait, by burntsushi! Whenever I hear of someone wanting to improve grep I think of the classic ridiculous fish piece[0]. But when I saw that this one was by the author of rust's regex tools, which I know from a previous post on here, are quite sophisticated, I perked up. Also, the tool aside, this blog post should be held up as the gold standard of what gets posted to hacker news: detailed, technical, interesting. Thanks for your hard work! Looking forward to taking this for a spin. [0] http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
ComputerGuru · 2016-08-24
I thought for a second this was one of my all-time favorites, which can also be summarized as "how is gnu grep so fast?" [0]. 0: http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
pavlov · 2014-03-31
Also check out this classic post written by an Apple engineer about CFArray/NSArray design: http://ridiculousfish.com/blog/posts/array.html It doesn't go into implementation details like the OP, but explains some of the thinking behind these class clusters.
Someone · 2013-11-25
It is useful for forcing all writes out to the storage device. If you device is battery/UPS backed, has enough capacity to flush its buffers (to disk or to flash memory) after a power loss, that is sufficient to (eventually) get your data on disk (yes,the drive may fail, but if that happens after the data has hit the platter, you have no guarantees, either) From what I understand, that behaviour is in spec (for me, borderline, at best, but I don't make that spec) according to http://pubs.opengroup.org/onlinepubs/009695399/functions/fsync.html ("physical write from the buffer cache", not "physical write to the disk") and, AFAIK, is what others do, too (http://ridiculousfish.com/blog/posts/mystery.html) Edit: http://lists.apple.com/archives/darwin-dev/2005/Feb/msg00072.html, referenced from that ridiculous fish post, gives more background info.
tambourine_man · 2013-08-26
Whenever I see something like this, I'm always reminded of this great post: http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
kbd · 2013-04-18
> I keep on typing that in, but due to the nature of Fish, it can't (or won't) recognise it. But the excellent history functionality does make up for this a fair bit. I was interested in this comment so I looked into the documentation to find out why this is. Here's a link to the FAQ for anyone else interested: http://ridiculousfish.com/shell/user_doc/html/faq.html#faq-history (last question)
js2 · 2012-09-05
Good read. Reminds me of the oldie but goodie http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
munimkazia · 2012-07-23
I've used bash all my life, but I am hooked on to fish's fish shell right now (http://ridiculousfish.com/shell/). The command prediction and auto-complete is amazing.
lemming · 2011-10-17
The best blogs don't have daily content. In fact, the best blogs usually post once a month, or less - often much less. Here are some: http://prog21.dadgum.com http://www.moserware.com http://ridiculousfish.com/blog http://wingolog.org/
Qerub · 2010-08-23
Everybody should read the great post "The Treacherous Optimization" about `grep` at http://ridiculousfish.com/blog/archives/2006/05/30/old-age-and-treache…
harpastum · 2009-02-05
This reminds me of a very interesting article on the same vein from the great (now sadly defunct) Ridiculous Fish The Treacherous Optimization http://ridiculousfish.com/blog/archives/2006/05/30/old-age-and-treache…
burntsushi · 2024-09-23
I didn't really want to engage with your broader point. I do disagree with it, but only in a measure of degree, and that's hard to debate because it's perspective and opinion oriented. If performance wasn't as important as you seem to imply, it's very unlikely that ripgrep would have gotten popular given that performance (and filtering) are its two more critical features. That is, that's what I hear from users the most: the like ripgrep because it's fast or because it filters or because of both. But on the smaller point, it is just factually untrue that GNU grep falls into the "performance will be looked at later" bucket. That was why I responded. This post is a classic about why GNU grep is fast, demonstrating that GNU grep definitely doesn't look like it wasn't optimized: https://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310… And then before that, there's this: https://ridiculousfish.com/blog/posts/old-age-and-treachery.html
DougMerritt · 2015-12-13
The "ack" you reference is apparently faster only in that it's easier to specify exactly which files to search or not to search, which obviously can also be done with grep, e.g. combined with 'find'. As for grep itself, it has had many incarnations over the decades with various pluses and minuses. The current GNU grep allows 3 kinds of regex, basic/extended/perl -- the latter being what ack supports. Note that Perl regexes have extensions beyond regular languages that are inherently slower than the automata specified by basic regexes. Power versus speed. E.g. grep(1): "Back-references are very slow, and may require exponential time." For further info: > why GNU grep is fast > Mike Haertel mike at ducky.net > Sat Aug 21 03:00:30 UTC 2010 > Here's a blog post from 2006 about a developer trying to "beat grep" and looking at the algorithms it uses; it goes into a little more detail about the "doesn't need to do the loop exit test at every step" optimization mentioned in this email. http://ridiculousfish.com/blog/posts/old-age-and-treachery.html via https://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310… The best writeup is surely by the inimitable Russ Cox, who really really explains clearly when grep as of 2007 was one of the only fast regex implementations: Regular Expression Matching Can Be Simple And Fast [#1] (but is slow in Java, Perl, PHP, Python, Ruby, ...) Russ Cox 2007 jan http://swtch.com/~rsc/regexp/regexp1.html (This is a 4 part…
epistasis · 2014-08-27
Yeah, I think calling him the "unenlightened" one is pretty off base here. For performing the tasks outlined by his examples, Unix utilities are easier for the user as well as executing faster than writing your own code in a general purpose programming language, unless one puts in the time to tune the implementation. One could rebuild AWK in C and get similar performance, but why not just use some extremely simple AWK? And is anybody going to replicate the amazing speed of grep without a huge time investment? [1] There is a right tool for the job, and having seen dozens of programmers be exposed to new big data sets, I can tell you that the ones who become productive quickly and stay more productive are the ones who adopt whatever tool is best for the job, not the ones that stick to their one favorite programming language. In fact, a good sign of somebody who will quickly fail is someone who says "forget those Unix tools, I'm just going to write this in X". [1] http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
jrmg · 2013-12-14
the iOS framework lacks a built-in queue The convention for this sort of thing is to use an NSArray, inserting at position 0 to enqueue and removing the last object to dequeue. The NSArray class is actually written in a way that makes this efficient (for some great analysis see http://ridiculousfish.com/blog/posts/array.html). or a sorted list (as far as I know) For sorted lists, I think you're right, you'd have to do it yourself. The question a Cocoa old-hand might ask would be if you _really_ need it to be always-sorted, or if you can keep your objects in an array, dictionary or set and sort them before using or iterating - or maybe just iterate the collection in a specific order instead of sorting it at all. If you do need to keep it sorted all the time, note that _inserting_ into an NSArray is also more efficient than you might assume. Keeping a sorted NSArray up to date yourself might not be expensive (it would be a bit more complicated than an auto-sorting class though, of course).
Jach · 2013-09-15
I think very few people equate intelligence with getting any job or making any money at all. Can you point me to someone who has? (Okay, I guess a more general form of 'intelligence' suggests it would be impossible for a slug to apply for and get any job on the market.) Similarly I don't think people equate intelligence with getting a good, high-paying job, but there is a good correlation showing more intelligence matches with higher income, and if you use that correlation in your predictions they will be more accurate. I watched "Dirty Jobs", great show. I agree a lot of jobs don't require much in terms of IQ, creativity, or rationality, but as you move up the scale of which jobs pay the most, you'll find they do start to require such things that commonly go into 'intelligence' definitions. You'll find counter-examples (like programmers that shouldn't be let anywhere near a computer, or CEOs who don't know a thing about their own business), but fewer and fewer. Bringing this comment back momentarily to the predictive power of intelligence, I would bet that a high IQ compilers programmer can learn to competently do any construction work job (many of such jobs use tools and methods that required high IQ people to come up with...) while a mid or low IQ construction worker couldn't learn to competently do compilers programming. In other words, having higher intelligence makes it a lot easier to change job fields, not just find and work at any job at all. (If you can find me…
jimbokun · 2013-08-05
"ObjC is a fine language, but when compared to other more modern tools in the same space (C++, Java, C#, D, Go, maybe Haskell, etc...) it really doesn't have much to recommend it." Much simpler than C++. Much more dynamic than any of the languages you mention. Can use straight C anyplace you need performance, with no FFI. Finally has some decent syntax for JSON types (NSDictionary/Array/Number), which some of those languages have and some don't. Performant collection classes. http://ridiculousfish.com/blog/posts/array.html Block syntax (Java famously lacks, those other languages have some equivalent). An outstanding UI library, unfortunately tied to Apple devices. I think Objective-C has stood up brilliantly to the test of time. The potential for Ruby-like flexibility with C-like performance, it's not an accident the software behind Apple's rise to the most valuable company in the world (for a time), was written in Objective-C.
stephth · 2011-05-01
No, but I'd love to hear about it. I see a lot of c++ devs complaining about how after 20 years they still haven't found a common ground on how to properly use c++ [1], its complicated memory management or its poor support for strings [2], things that are taken for granted with objc and Core Foundation. On one side I see an incredible amount of developers dealing with high amounts of complexity with C++, and on the other hand this low-level dynamic language with a powerful [3] open-source standard library [4] that is sadly only commonly used to build Cocoa apps. I'd love to hear about objc+CF for things like game development on other platforms than iOS or OSX, or an explanation to why it's not happening. I really really don't mean to instigate a flame war here -- I'd just love to hear more about this topic. [1] http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml [2] http://benjamin.smedbergs.us/blog/2007-11-05/what-if/ [3] http://ridiculousfish.com/blog/archives/2005/12/23/array/ [4] http://en.wikipedia.org/wiki/Core_Foundation

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close