• 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: Cameron Hayne <email@hidden>
  • Date: Mon, 17 Oct 2005 18:56:13 -0400


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.


It would be even better to make it data driven, with the various parameters etc read from data files that are separate from the source files.

And you could (and should) separate the GUI parts (e.g. that define NSButtons) from the model parts (that define what the player attributes are and how they change).

But even without changing the code itself to reduce the overall number of lines of code, you could break it up into several files by brute force via use of Objective-C categories.

--
Cameron Hayne
email@hidden


_______________________________________________ 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: shin kurokawa <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>)

  • Prev by Date: Re: Speeding up XCode?
  • Next by Date: Re: Open Recent command?
  • Previous by thread: Re: Speeding up XCode?
  • Next by thread: Re: Speeding up XCode?
  • Index(es):
    • Date
    • Thread