Re: Xcode 4.3.1 memory usage
Re: Xcode 4.3.1 memory usage
- Subject: Re: Xcode 4.3.1 memory usage
- From: Jens Alfke <email@hidden>
- Date: Fri, 16 Mar 2012 16:02:02 -0700
That source file contains a pathologically long method named -fillMatrix:withObject:. It’s over 3000 lines long! Huge functions like this have always presented problems for code optimizers — I’m not an expert on compiler techniques, but I believe there are data structures and algorithms used in optimization that tend to grow as at least O(n^2) with the number of basic blocks or branches in the function being optimized.
As a result, code like this very often causes compilation to take a very long time, or use huge amounts of memory, or both. I’ve seen this in lots of projects over the years.
The lesson is Don’t Write Huge Functions. Besides giving compilers fits, they’re also very difficult to read and understand. A function that long nearly always should be broken up into lots of smaller functions. The only exceptions I’ve seen are intensely performance-critical functions like the inner loops of interpreters, but this doesn’t look like one of those. It just looks really badly written. :-p
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden