[sword-devel] optimizations

Daniel Glassey sword-devel@crosswire.org
Thu, 14 Feb 2002 02:40:43 +0000


--------------Boundary-00=_VR4I39TB2QUL9WJRZBNU
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Wednesday 13 Feb 2002 11:48 pm, you wrote:
> Then I will start an
> optimization pass.  Seems we really need this as our .4 second, complete
> bible search is up to about 2.9 seconds on my 1.13GHz laptop :)  We'll
> get it back down, Lord willing.

Hi,
I've attached a file showing the main culprits in a profile of mgrtest (with 
functioncheck 1.4 www.sf.net/projects/fnccheck) with an added loop of 10 
seaches for "in the beginning" for each of 4 modules. The profiling skews 
things a bit by making calls to profiled functions relatively expensive, but 
it still looks nasty.

A large amount of time is spent applying filters in StripText - 
SWModule::filterBuffer. I don't know where to start with this but it really 
needs to be got down. Are all the optionfilters and stripfilters really 
needed or could there be just one filter that could be applied to strip the 
text?

Another thing that takes a long time is the Index function which is called on 
swmodule++	

hth,
Daniel
--------------Boundary-00=_VR4I39TB2QUL9WJRZBNU
Content-Type: text/plain;
  charset="iso-8859-1";
  name="gprmgr.tmp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gprmgr.tmp"

RmxhdCBwcm9maWxlOgoKfCAgICAgIGxvY2FsICAgICAgfCAgICAgIHRvdGFsICAgICAgfCAgICAg
ICAgICB8ICAgICAgICAgICB8CnwgICAgICBzZWMuIHwgICUgIHwgICAgICBzZWMuIHwgICUgIHwg
Y2FsbHMgICAgfHQuIHNlYy9jYWxsfCBuYW1lCnwtLS0tLS0tLS0tLXwtLS0tLXwtLS0tLS0tLS0t
LXwtLS0tLXwtLS0tLS0tLS0tfC0tLS0tLS0tLS0tfC0tLS0tLS0tCnwgICAwLjAwNTU2NXwgIDAu
MHwgMTg0LjE5MDMwNHwgOTcuOHwgICAgICAgICAxfCAxODQuMTkwMzA0fCBtYWluCnwgICA2LjUx
NDgwMXwgIDMuNXwgMTg0LjA0MTExMHwgOTcuN3wgICAgICAgIDQwf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fCAgIDAuMDAzMDI2fCBaaXBDb21w
cmVzczo6RGVjb2RlKHZvaWQpCnwgICAxLjk0MTIxNHwgIDEuMHwgICAxLjk0MTIxNHwgIDEuMHwg
ICAgMzExMDIxfCAgIDAuMDAwMDA2fCB6VmVyc2U6OnByZXB0ZXh0KGNoYXIgKikKfCAgIDAuNjgx
Njg4fCAgMC40fCAgIDEuMjYxMjE5fCAgMC43fCAgICAzMTIyMDJ8ICAgMC4wMDAwMDR8IFNXS2V5
OjpTV0tleShTV0tleSBjb25zdCAmKQp8ICAgMS4yMTI4OTJ8ICAwLjZ8ICAgMS4yMTI4OTJ8ICAw
LjZ8ICAgMTg2NjEwN3wgICAwLjAwMDAwMXwgX0xpc3RfaXRlcmF0b3I8U1dGaWx0ZXIgKiwgU1dG
aWx0ZXIgKiYsIFNXRmlsdGVyICoqPjo6b3BlcmF0b3IrKyh2b2lkKQp8ICAgMS4xNjE1NzN8ICAw
LjZ8ICAgMS4xNjE1NzN8ICAwLjZ8ICAgMTg2NjEwN3wgICAwLjAwMDAwMXwgX0xpc3RfaXRlcmF0
b3I8U1dGaWx0ZXIgKiwgU1dGaWx0ZXIgKiYsIFNXRmlsdGVyICoqPjo6b3BlcmF0b3IqKHZvaWQp
IGNvbnN0CnwgICAxLjE1MDExM3wgIDAuNnwgICAxLjE1MDExM3wgIDAuNnwgICAxMzEyMzU0fCAg
IDAuMDAwMDAxfCBzdHJpY21wKGNoYXIgY29uc3QgKiwgY2hhciBjb25zdCAqKQ==

--------------Boundary-00=_VR4I39TB2QUL9WJRZBNU--

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com