M

Mike Ash

mikeash.com · Personal blog · on HN since 2008

Mike Ash writes technical posts on Apple platforms, covering Objective-C internals, ARM64, and low-level performance.

What HN saysCommenters cite it as an example of in-depth analysis, especially the objc_msgSend on ARM64 and tagged pointer posts.
170HN people shared it
103linked it in comments
145stories submitted
3.7Kstory points
5 months agolast shared
2008people per year2026

Most-shared posts

  1. 1
    ARM64 and You
    20 people · 296 points · first shared 2013 · 106 comments on HN
  2. 2
    Pyblog
    15 people · first shared 2011
  3. 3
    What Is the Secure Enclave?
    9 people · 164 points · first shared 2016 · 57 comments on HN
  4. 4
    Tagged Pointer Strings
    8 people · 111 points · first shared 2015 · 27 comments on HN
  5. 5
    Dissecting objc_msgSend on ARM64
    8 people · 83 points · first shared 2017 · 57 comments on HN
  6. 6
  7. 7
    Getting Answers
    7 people · 95 points · first shared 2009 · 21 comments on HN
  8. 8
    Objc_msgSend's New Prototype
    7 people · 90 points · first shared 2019 · 54 comments on HN
  9. 9
  10. 10
    Let's Build Tagged Pointers (2012)
    6 people · 7 points · first shared 2013 · discussion on HN
  11. 11
    NSBlog: Let's Build objc_msgSend
    6 people · 1 points · first shared 2012 · discussion on HN
  12. 12
    Why Is Swift's String API So Hard?
    5 people · 97 points · first shared 2015 · 114 comments on HN
  13. 13
    Ring Buffers and Mirrored Memory: Part I (2012)
    5 people · 3 points · first shared 2015 · discussion on HN
  14. 14
    Secrets of dispatch_once; x86 performance trickery
    4 people · 135 points · first shared 2014 · 31 comments on HN
  15. 15
    Covariance and Contravariance
    3 people · 158 points · first shared 2015 · 67 comments on HN

What HN people wrote when they linked it

mcormier · 2009-06-09
Static analysis has been available outside of Xcode for some time now. Clang is a great tool. http://www.mikeash.com/?page=pyblog/friday-qa-2009-03-06-using-the-cla… I haven't tried valgrind yet but there is a little buzz about it. http://www.mikeash.com/?page=pyblog/friday-qa-2009-06-05-introduction-…
plagiarist · 2024-11-28
The idea in the paper is really cool. People who enjoyed this might also like to read how Apple used tagged pointers for short strings in Objective-C [0]. I think that's when I first learned about tagged pointers. NaN-boxing was mindblowing for me. I love this kind of stuff. [0] https://mikeash.com/pyblog/friday-qa-2015-07-31-tagged-pointer-strings…
chmaynard · 2020-09-25
There are some great examples of this type of in-depth analysis in Mike Ash's blog: https://mikeash.com/pyblog/
cameldrv · 2018-08-09
AFAIK objc_msgSend is always called, but it's very heavily optimized and written in assembly language. Mike Ash had a great post: https://www.mikeash.com/pyblog/friday-qa-2017-06-30-dissecting-objc_ms…
tzahola · 2018-05-12
Even though people love bashing Objective-C for its “weird” method syntax, it trivially circumvents these kind of problems. Also related: Mike Ash’s post about using single-member C structs instead of unitless scalar types: https://www.mikeash.com/pyblog/friday-qa-2013-08-02-type-safe-scalars-…
tinus_hn · 2017-12-09
Objective-C is two parts, a compiler and a runtime. Both are reasonably simple but there are many details that are important. Check out Mike Ashes excellent blog about Objective-C, the runtime and many other things: https://mikeash.com/pyblog/
myko · 2017-09-02
Mike Ash's blog: https://www.mikeash.com/pyblog/ Always impresses me with the depth put into each post. Great blog for a Cocoa developer to follow.
mikeash · 2017-05-07
My favorite level 5 was a bug in clang that caused it to occasionally emit incorrect code when calling a vararg function. However, the bug was harmless when combined with clang's vararg function prologue. When calling a vararg function compiled with gcc, the clang bug would cause gcc's prologue to jump to a quasi-random address vaguely nearby and continue execution in the middle of some other function. That was great fun. I wrote it up here: https://www.mikeash.com/pyblog/friday-qa-2013-06-28-anatomy-of-a-compi…
btrask · 2016-05-06
If you are already familiar with high-level Objective-C, I would recommend looking at the headers for the language runtime. All of the inner workings are exposed as C functions you can play with. Also take a look at Mike Ash's blog, which dives into a lot of details: https://mikeash.com/pyblog/?tag=objectivec Also: http://www.sealiesoftware.com/blog/archive/index.html
twoodfin · 2016-01-28
mikeash has a great post on Apple's tagged pointer for NSString: https://www.mikeash.com/pyblog/friday-qa-2015-07-31-tagged-pointer-str… In that environment, you only have 60 bits to play with, so it's more aggressive about varying encodings to fit in more common strings.
pcwalton · 2015-07-12
There are exceptions to this rule--i.e. there are ways to not really be thread-safe but to have things work anyway--but they fall in the category of "you have to really, really know your CPU and be willing to write processor-specific code that just happens to work", so you can basically ignore them. My favorite is the libdispatch abuse of cpuid to flood the pipeline on Intel CPUs for this problem: https://www.mikeash.com/pyblog/friday-qa-2014-06-06-secrets-of-dispatc… But really, take Coda's advice. If you aren't synchronizing your reads, you can basically just assume your code is broken.
ColinWright · 2015-03-26
So why are you asking here instead of following the directions and contacting them via the support page: http://foundation.zurb.com/support/support.html Can I also suggest that you read this: https://www.mikeash.com/getting_answers.html And I'm confused by what you mean when you say "it uses sudo as root". You can login as root by using: sudo su and then giving your password. Warning, this is extremely dangerous! As root you can completely screw your system. However, if it's your own install you can easily login as root.
gurkendoktor · 2015-03-21
> practically everything is allocated on the heap It has gotten a lot better thanks to tagged pointers: https://www.mikeash.com/pyblog/friday-qa-2012-07-27-lets-build-tagged-… Objective C is mostly used for UI code, and I think it's a fantastic language for that, with its Ruby-like weak typing and strong metaprogramming capabilities.
Someone · 2014-07-13
"If we use a single bit dedicated to signalling NaN, the overhead might be worth it. Of course, we lose half of our range in doing so." You don't need to lose half your range; you can also add a bit. You only need to add a sticky overflow bit to each register, keep the arithmetic hardware as-is, and modify loads to set the sticky overflow when reading the NaN pattern, and modify writes to write 0b1000...000 when writing a register whose sticky overflow bit is set. Hardware cost would, I think, be very small, as you would only need a bit per register, and keep memory as-is. Given that Apple has non-wrap around ints in Swift and designs its own CPUs, it wouldn't surprise me if they added something similar or their CPUs, just as I expect them to add instructions for loading from tagged pointers (https://www.mikeash.com/pyblog/friday-qa-2012-07-27-lets-build-tagged-…
rismay · 2014-02-11
Come on guys: NSBlog That Mike Ash is amazing. https://www.mikeash.com/pyblog/ Also: Ash Furrow. That guy is serious about helping. http://ashfurrow.com/
danielsju6 · 2013-12-16
hboon · 2013-03-12
I've been meaning to ask for a long time. Are you this http://www.mikeash.com Mike Ash?
wsc981 · 2012-12-21
As an Objective-C (iOS) developer, I really love blocks. I thought the syntax was kind of weird when starting to learn it, but it's grown on me. I really hope ObjC blocks will become part of the C standard someday. If I remember people have proposed C++ lambdas to become part of the C standard as well. It will be interesting to see which one (if any) will win in a standardising process. More info on ObjC blocks vs C++ lambdas in this blog posting: http://www.mikeash.com/pyblog/friday-qa-2011-06-03-objective-c-blocks-…
msbarnett · 2012-12-16
Mike Ash's Friday Q&A is easily one of my favorite technical blogs http://www.mikeash.com/pyblog/
mocko · 2012-07-29
Excellent instructions for doing this on a mac with http://www.mikeash.com/ssh_socks.html I am an Englishman sheltering from the Olympics in NYC (public transport in London was always going to be a mess) and even though I possess a UK TV license I had to tunnel through my machine at home to watch the opening ceremony. It's a shame the BBC can't just sell a stream to people elsewhere in the world but the licenses under which they get the content will prevent it. Otherwise people could get content from the lowest bidder in the world, meaning commoditisation and a massive hit to the content owners who wouldn't get to sell the rights over and over again in different countries.
rfreytag · 2011-07-05
Polycarbonate is not used widely because is VERY expensive to fit and replace. My glider canopy is $5000 replaced: http://www.mikeash.com/my_glider.html (ask me how I know). Note even the canopy for the ancient but popular ASK-13 is over $2000 on this site: http://www.wingsandwheels.com/glider_canopies.htm Installing these babies is really tricky. Nothing ever fits quite right from the factory. Worth another $3000 easy in labor; after all it is an aircraft.
rudiger · 2011-04-08
NSBlog - http://www.mikeash.com/pyblog/ Also highly recommend their The Complete Friday Q&A; it's a book compiled from their Friday articles that covers advanced topics in Mac OS X and iOS programming.
pohl · 2009-08-24
I think the point of GCD is that the concept is being brought down to the C, C++, and Objective-C layers, through the introduction of "blocks"... http://www.mikeash.com/?page=pyblog/friday-qa-2008-12-26.html http://www.mikeash.com/?page=pyblog/friday-qa-2009-08-14-practical-blo… I agree there's too much marketing hype surrounding GCD, but neither the CLR nor the JVM can jump through that particular hoop.
worthless-trash · 2024-07-16
> Not everyone is using linux. Correct, it also fails on IOS the same way ( https://www.mikeash.com/pyblog/friday-qa-2010-12-17-custom-object-allo… ), I haven't checked on more recent IOS versions, but it used to. I imagine that sooner than later apple may merge IOS and OSX kernels, who knows. If the solution proposed is not to work on the 3 of the common operating systems(IOS, ANDROID, LINUX) adoption may be a problem. > malloc can fail, Yes, only if you allocate greater than the virtual address space in a process, or if you don't use an optimistic allocator (or disable overcommit) it could, I suggest you try this to find some REAL shady offenders that just abuse memory use, lodge bugs and then record the response (or lack thereof). I have tried this for a bunch of utilities, and have had a hard time convincing software developers that they don't need to do insane things. > and should fail. I absolutely agree, fixing this problem means 'fixing and solving the problem for all software' which is something that is a very hard problem to solve, if you do find a way let me know.
RiderOfGiraffes · 2013-12-27
Here's some very personal advice. This is my opinion, and others won't agree. However, for what it's worth ... I would suggest that you would benefit from learning how to ask questions. Here's a start: http://www.catb.org/~esr/faqs/smart-questions.html However, there's more advice than that, and that, although a good start, is not to be taken as gospel. You probably also should read the site-specific commentary, and suggested alternatives: https://mikeash.com/getting_answers.html https://news.ycombinator.com/item?id=2911381 The point is this - you said: Well, TCP is a very simple protocol so I can't imagine what the OP means by "all of TCP" unless he's talking about IP and it's associated services. Here's an alternative: I'm not sure I understand what's been left out of this. Could someone provide a synopsis, and a pointer to more details? Your comment comes across as "Well I know everything, so the only thing that's left out must be all the internet." The second admits that you don't know what people are talking about, and asks for more information. And just as a final question - why do you think you've been hell-banned? Are you sure? In particular, I've turned on "Show dead", and you don't seem to have made any comments that have been auto-killed. The evidence suggests you are not hell-banned.
gonzo · 2013-12-17
I can't really say it better than Mike Ash, so: <quote> Conclusion The "64-bit" A7 is not just a marketing gimmic, but neither is it an amazing breakthrough that enables a new class of applications. The truth, as happens often, lies in between. The simple fact of moving to 64-bit does little. It makes for slightly faster computations in some cases, somewhat higher memory usage for most programs, and makes certain programming techniques more viable. Overall, it's not hugely significant. The ARM architecture changed a bunch of other things in its transition to 64-bit. An increased number of registers and a revised, streamlined instruction set make for a nice performance gain over 32-bit ARM. Apple took advantage of the transition to make some changes of their own. The biggest change is an inline retain count, which eliminates the need to perform a costly hash table lookup for retain and release operations in the common case. Since those operations are so common in most Objective-C code, this is a big win. Per-object resource cleanup flags make object deallocation quite a bit faster in certain cases. All in all, the cost of creating and destroying an object is roughly cut in half. Tagged pointers also make for a nice performance win as well as reduced memory use. </quote> https://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and-you.html Android's Java runtime is going to need a lot of work to make it pull off a runtime feat like tagged pointers.
AlexanderDhoore · 2013-12-16
"The "64-bit" A7 is not just a marketing gimmic, but neither is it an amazing breakthrough that enables a new class of applications. The truth, as happens often, lies in between. The simple fact of moving to 64-bit does little. It makes for slightly faster computations in some cases, somewhat higher memory usage for most programs, and makes certain programming techniques more viable. Overall, it's not hugely significant. The ARM architecture changed a bunch of other things in its transition to 64-bit. An increased number of registers and a revised, streamlined instruction set make for a nice performance gain over 32-bit ARM. Apple took advantage of the transition to make some changes of their own. The biggest change is an inline retain count, which eliminates the need to perform a costly hash table lookup for retain and release operations in the common case. Since those operations are so common in most Objective-C code, this is a big win. Per-object resource cleanup flags make object deallocation quite a bit faster in certain cases. All in all, the cost of creating and destroying an object is roughly cut in half. Tagged pointers also make for a nice performance win as well as reduced memory use." [1] https://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and-you.html
vasi · 2010-12-09
I think the article vastly overstates its case. Nobody disputes that it's possible to have more-or-less working memory management in ref-counted Objective-C. But it's clearly harder than in a GC language, else it wouldn't need seven pages worth of "simple rules" to explain. Moreover, the author glosses over many of subtleties of reference-counting. For example, accessors in Java are dead-simple, practically boilerplate. But in Cocoa, what looks like a perfectly reasonable implementation to a newcomer is in fact buggy: - setFoo: (id)aFoo { [foo release]; foo = [aFoo retain]; } Look closely, and you'll realize that if foo and aFoo are in fact the same object, it will be freed, and foo will have an invalid pointer assigned to it. Pretty much every Cocoa programmer knows about this, but we shouldn't ahve to. One of the better Cocoa blogs is written by Mike Ash, and he has quite a few posts that illustrate some of these issues. For example, the first half of http://www.mikeash.com/pyblog/friday-qa-2010-12-03-accessors-memory-ma… talks about whether or not accessors should autorelease their return values, with pros and cons for each option. Later on, the money quote: "If you're using garbage collection, this whole question becomes vastly simpler." Our author here says that "Cyclic object graphs in Objective-C are not a problem. At all." But another post by Mike Ash illustrates that it can be harder to deal with:…

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