• 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: Speeding up XCode?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speeding up XCode?


  • Subject: Re: Speeding up XCode?
  • From: shin kurokawa <email@hidden>
  • Date: Mon, 17 Oct 2005 21:01:12 -0400
  • Organization: m.o.d.


That code snippet is poorly written if it's supposed to be for a performance-critical release. But often during the initial development phase, some of us actually like writing out matrix operations like these (..though usually much more complicated than this particular example) especially when they involve very, very heavily-nested loops, if just for debugging and legibility sake --- The idea being that, once the loops(or whatever) in question do what they're supposed to do, only then we should hand-optimize by rewritng, registering the most often-accessed values, etc, at the expense of less-legible code, besides IMHO/IME optimizing during the initial coding phase seems actually counter-productive.

I wouldn't be surprised if stuff like this would
really become a non-issue as compilers' optimizers
get smarter at recognizing patterns in a given code, but
I'd be really surprised if that happened tomorrow. ;)
-Shin


Cameron Hayne wrote:

On 17-Oct-05, at 6:00 PM, Robert Dell wrote:

check it out at http://sourceforge.net/projects/yasse/
I'm sure i can break out smaller sections but then i'd only be doing lots of includes in the main file which wouldn't solve the problem as I hear you folks describing it.


I looked at that code (specifically the file yasse.m which is 22K lines) and it seems to me that it is desperately crying out for more use of functions to replace all the repetitive code.
For example, there are pages and pages of code like this:


magicreqs = magicTotal - (((nextcircle-70)*33)+1720);
i = [self getMagicPosition: @"Power"];
mymagic[i].skillreqs = mymagic[i].skillvalue-((((nextcircle-70) *6)+320)*100);
i = [self getLorePosition: @"Scholarship"];
mylore[i].skillreqs = mylore[i].skillvalue-((((nextcircle-70)*4) +210)*100);
i = [self getLorePosition: @"Teaching"];
mylore[i].skillreqs = mylore[i].skillvalue-((((nextcircle-70)*2) +140)*100);
i = [self getLorePosition: @"Astrology"];
mylore[i].skillreqs = mylore[i].skillvalue-((((nextcircle-70)*4) +180)*100);
mylore[0].skillreqs = mylore[0].skillvalue-((((nextcircle-70)*3) +180)*100);
mylore[1].skillreqs = mylore[1].skillvalue-((((nextcircle-70)*2) +0)*100);
mysurvival[0].skillreqs = mysurvival[0].skillvalue - ((((nextcircle-70)*3)+180)*100);
mysurvival[1].skillreqs = mysurvival[1].skillvalue - ((((nextcircle-70)*3)+180)*100);
mysurvival[2].skillreqs = mysurvival[2].skillvalue - ((((nextcircle-70)*2)+140)*100);
mysurvival[3].skillreqs = mysurvival[3].skillvalue - ((((nextcircle-70)*2)+140)*100);
mysurvival[4].skillreqs = mysurvival[4].skillvalue - ((((nextcircle-70)*2)+140)*100);
mysurvival[5].skillreqs = mysurvival[5].skillvalue - ((((nextcircle-70)*2)+140)*100);
mysurvival[6].skillreqs = mysurvival[6].skillvalue - ((((nextcircle-70)*2)+20)*100);
mysurvival[7].skillreqs = mysurvival[7].skillvalue - ((((nextcircle-70)*2)+20)*100);


That could (and should) be parameterized into a function. Doing that would drastically cut down on the number of lines of code. Of course it would be a fairly large amount of work to do this now. Maybe some clever regex search & replaces could do it.

_______________________________________________
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


  • Follow-Ups:
    • Re: Speeding up XCode?
      • From: Robert Dell <email@hidden>
References: 
 >Speeding up XCode? (From: Mark Wagner <email@hidden>)
 >Re: Speeding up XCode? (From: Robert Dell <email@hidden>)
 >Re: Speeding up XCode? (From: Cameron Hayne <email@hidden>)
 >Re: Speeding up XCode? (From: Andreas Mayer <email@hidden>)
 >Re: Speeding up XCode? (From: Robert Dell <email@hidden>)
 >Re: Speeding up XCode? (From: Cameron Hayne <email@hidden>)

  • Prev by Date: Re: Having Image PICT NIB problem ?
  • Next by Date: Re: Speeding up XCode?
  • Previous by thread: Re: Speeding up XCode?
  • Next by thread: Re: Speeding up XCode?
  • Index(es):
    • Date
    • Thread