• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa and dead-code stripping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa and dead-code stripping


  • Subject: Re: Cocoa and dead-code stripping
  • From: Steve Christensen <email@hidden>
  • Date: Mon, 2 Jul 2007 09:46:12 -0700

On 02.07.2007, at 04:31, Steve Christensen wrote:

So it sounds like, if I want to end up with reasonably-sized code, that I should create just the classes (and methods) that I need for a particular task. When I want to do something similar, it sounds like I should copy the class sources into another target, add some methods, etc., and then compile/link that version?

On Jul 1, 2007, at 7:41 PM, Chris Suter wrote:

Is code bloat a problem for you? The approach you suggest doesn't sound very maintainable to me. How much unused code are you talking about and what problem are you trying to fix by keeping it down?

Code bloat isn't currently a problem since the linker is pretty good about stripping out unused pieces. But one of our product delivery methods is by download so keeping everything as small as possible is a good thing.


Let me back up a bit. As I said, I'm coming from the C++/Carbon world (and will continue to use a lot of that code). I've created a static library that contains a bunch of common classes and routines that can be compiled once and linked into various targets.

I'm currently working with around 80 application plug-ins I've written that link against this static library. All the plug-ins use a number of features, plus each plug-in individually uses various other features, depending on what it specifically requires. So come link time, the linker strips out all the pieces a particular plug-in isn't using. No magic there.

Going forward, I'm working to move my UI (and selected other pieces) to Cocoa. Given the number of builds I'm doing, I'd still like to compile the common pieces once, including the Cocoa bits. I'd also like to, ideally, not have a bunch of never-used methods left in the binary.

If I were writing a single application then the incremental size of the code might not be a big deal. In my case it could be as much as 80x the incremental size.


On Jul 2, 2007, at 8:33 AM, Uli Kusterer replied:

No! Use categories and subclasses to segment your code, so you can just leave out a particular category or subclass where you don't need its functionality.

Copy & Paste, when it comes to programming, is Evil(tm). [usual caveats apply, YMMV, void where prohibited by law]

To be clear, I am not currently, nor do I plan to, do any sort of copy-paste for these shared classes as I strive not to be too Evil (tm). :-)


steve

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cocoa and dead-code stripping
      • From: Chris Hanson <email@hidden>
References: 
 >Cocoa and dead-code stripping (From: Steve Christensen <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Chris Suter <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Steve Christensen <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Memory Management Question
  • Next by Date: Re: Cocoa and dead-code stripping
  • Previous by thread: Re: Cocoa and dead-code stripping
  • Next by thread: Re: Cocoa and dead-code stripping
  • Index(es):
    • Date
    • Thread