Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Efficient STRing ComPaRes Message-ID: <15511@smoke.brl.mil> Date: 19 Mar 91 05:20:48 GMT References: <1991Mar18.142342@mars.mpr.ca> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 18 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).