Path: utzoo!attcan!uunet!snorkelwacker!apple!sun-barr!newstop!sun!argv From: argv@turnpike.Eng.Sun.COM (Dan Heller) Newsgroups: comp.windows.x.motif Subject: Re: Optimization / Speedups Message-ID: <140707@sun.Eng.Sun.COM> Date: 15 Aug 90 19:36:11 GMT References: <9007@uhccux.uhcc.Hawaii.Edu> Sender: news@sun.Eng.Sun.COM Organization: O'Reilly && Associates Lines: 30 In article <9007@uhccux.uhcc.Hawaii.Edu> john@quonset.cfht.hawaii.edu (John Kerr) writes: > Are there any general hints for speeding up a Motif application? For > instance, does eliminating the resource file and hard-coding the > resources make for faster startup and execution? You should be very careful about this decision -- from the user's point of view, many resources should be configurable and you should not hard-code values. The _general rule of thumb_ is: hardcode as few resources as possible. *however* it is perfectly reasonable to hardcode many values and it is not uncommon to do so. You just need to be aware of each one and ask yourself, is it reasonable to expect the user to modify this resource himself? The answer to your question, on the other hand, is simple. You are not going to improve performance or provide any other optimizations by hardcoding values. Performance of motif applications seems to be in the utilization of resources and widgets. That is, allocating and freeing large blocks of memory takes time -- anything that you do *repeatedly* will affect performance. Converting between text and XmString's can be expensive if you do it frequently (hint: cache as much as possible). Also, some actions seem like they perform reasonably in small-scale situations (e.g., short lists for list widget or short text for text widgets), but suddenly performance goes down the drain when your lists or texts suddenly become large. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.