Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Objective-C objects are not really "simple," so 50,000 of them is going to be pretty demanding. Write your own in straight C or C++ if you want to avoid the bottlenecks and resource demands of the Objective-C runtime. </p> <p>A rather lengthy and non-theoretical discussion of the overhead associated with convenience:</p> <p><a href="http://www.cocoabuilder.com/archive/cocoa/35145-nsarray-overhead-question.html#35128" rel="nofollow noreferrer">http://www.cocoabuilder.com/archive/cocoa/35145-nsarray-overhead-question.html#35128</a></p> <p>And some simple math for simple people:</p> <blockquote> <p>All it takes to make an object as opposed to a struct is a single pointer at the beginning.</p> </blockquote> <p>Let's say that's true, and let's say we're running on a 32-bit system with 4 byte pointers.</p> <p>4 bytes x 50,000 objects = 200000 bytes</p> <p>That's nearly 200MB worth of extra memory that your data suddenly needs <em>just because</em> you used Objective-C. Now compound that with the fact that whatever NSArray you add those objects <em>to</em> is going to double that by keeping its own set of pointers to those objects and you've just chewed up 400MB of RAM just so you could use a couple of convenience wrappers. </p> <p>Refresh my memory here... Are swap files on hard drives as fast as RAM? How much RAM is there in an iPhone? How many function calls and stack frames does it take to send an object a message? Why isn't IOKit written in Objective-C? How many of Apple's flagship applications that do a lot of DSP use AppKit? Anybody got a copy of otool they can check with? I'm seeing zero here. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload