Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] Colors and locale warning

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Andrew <afrayedknot AT thefrayedknot.armory.com>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] Colors and locale warning
  • Date: Mon, 17 May 2004 10:05:19 -0700

> >
> > for MODULE in `ls $SGL_LIBRARY_MODULES/lib*[^~]`; do
>
> That's very bad anyway, using for SOMETHING in `ls ...` can break in so
> many ways ...
> Why not just
> for MODULE in "$SGL_LIBRARY_MODULES"/lib*[^~]; do
>
> That will even work if SGL_LIBRARY_MODULES contains spaces or other
> crap.
>

Not only that, it will be significantly faster, the `ls` version has to
fork a subshell to run ls in, then actually run ls. That ammounts to
two seperate forks when we could have just used wildcard expansion to
begin with.

On a side note, I did some benchmarking of out libhash library. It seems
that all of the frontend calls call hash_build_variable_name in a
` ` subshell in-order to build the variable name. If instead we
1) pull all of its relavent code out into the few calling functions
2) change it to set a variable by reference
it will run significantly faster.

Currently to set 1000 hash values it takes 5 seconds, the users of
devel sorcery will have noticed the "Computing previously installed
depends..." message takes several seconds to complete (it used to be
quite a bit slower). This is the reason why.

However if we get rid of the use of the subshell in libhash, then we
can do a 1000 libhash operations in less than half a second.

(just a suggestion)

-Andrew


--
__________________________________________________________________________
|Andrew D. Stitt | astitt at sourcemage.org |
|irc: afrayedknot | afrayedknot at t.armory.com |
|aim: thefrayedknot or iteratorplusplus | |
|Sorcery Team Lead, Porting Team Lead | |
|Grimoire Guru ham/smgl | ftp://t.armory.com |
|Author and Maintainer of Prometheus | |
--------------------------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page