stone@mars.mpr.ca (Darren Stone) (03/19/91)
Just wanted to say "THANX!" to all who responded by posting or mailing. As it turns out, the best alternative for me will be to compare the first chars before initiating the strcmp() function call. Next may have to come some algorithm restructuring (the real performance problem!) -- I shouldn't blame poor little strcmp() for my design problems! - Darren - LONG LIVE strcmp() !
gwyn@smoke.brl.mil (Doug Gwyn) (03/19/91)
In article <1991Mar18.142342@mars.mpr.ca> stone@mars.mpr.ca (Darren Stone) writes: >Next may have to come some algorithm restructuring (the >real performance problem!) -- I shouldn't blame poor >little strcmp() for my design problems! You might want to consider a trick we used in the MUVES project -- a package named "Nm" provided support for "name pools", each of which could hold an arbitrary number of strings. The main point of a name pool is that each distinct string was assigned a distinct INTEGER index into the name pool, and it was these INTEGERS that were passed around, compared, etc. in the application. Obviously the use of the integer indices is far more efficient than handling the strings as character arrays. If the strings are handled very many times apiece, the performance tradeoff from putting them into a name pool and handling the indices instead is a big win. Contact me if you want the code for the MUVES "Nm" package (I'll have to include some other support packages, such as the "Mm" memory management package, and you'll have to figure out how to adapt the Makefiles to your needs).