[sword-devel] Search optimized (still too slow)

Joachim Ansorg sword-devel@crosswire.org
Thu, 8 Apr 2004 15:59:44 +0200


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I spent some time to optimize the search in CVS.
The problem is/was for example the extensive the use of XMLTag in the filters, 
I tried to avoid them in the filters where it was possible without having to 
rewrite them.
I also used SWBuf::append directly where SWBuf::operator+ was used before.

I see some good chances where we can optimize:
	-Using XMLTag as few as possible
	-Change copy constructor of SWBuf to implicit sharing, we have lots of SWBuf 
copy-constructor calls I think
	-optimize SWBuf::append(char), maybe we can tweak the memory allocation to 
alloc larger blocks but more seldom. the append(char) function gets called 
more than any other function in a search

But the best solution would be to parse the text only once and then do the 
right stuff with it. ATM each filter parses the text again which will make 
modules with lot's of filters slow (e.g. KJV).

I got these results (with debug code and profiling code included):
WEB:
before:	0m8.233s
after:	0m7.586s
	
KJV:
before:	1m35.769s
after:	0m21.874s


I have not yet committed, because I have to make sure the code doesn't have 
some untested bugs.

Joachim
- -- 
<>< Re: deemed!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAdVrUEyRIb2AZBB0RAps7AKC0fqFICmN2bMp5fc5ZTTgegyTn3QCghcjV
2yE6KnS4ma6u4YnVY7i7HSI=
=J65x
-----END PGP SIGNATURE-----