Resedit (Was: Proposal for KControl)

Simon Perreault nomis80 at linuxquebec.com
Mon Jul 1 23:27:10 BST 2002


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

On July 1 2002 05:53 pm, Guillaume Laurent wrote:
> On Monday 01 July 2002 22:36, aleXXX wrote:
> > ...and it will slowdown config file parsing and app startup (we read more
> > than 10 config files for every app that starts).
> > Ok, the parsing of a line stops after a "#" was found, but nevertheless
> > it has to run over all the bytes, and such a change would more or less
> > double the line number of each config file, wouldn't it ?
>
> Even if it would triple or quadruple it, you'd still wouldn't notice a
> difference.

I tested how heavy the skipping of lines beginning with '#' was with two perl 
scripts. First one:

while (<>) {
    print;
    next if /^#/;
}

Second one:

while (<>) {
    print;
}

I gave them as input a file containing 1 000 000 lines randomly alternating 
between commented and not commented. The scripts print the same amount of 
lines so the difference is not influenced by the number of lines skipped. And 
Perl is not intelligent enough to optimize away the check for /^#/. The 
output is piped to /dev/null so it doesn't rely on the video system.

The results:
Test 1: 2.384s
Test 2: 1.638s

The difference is about .75 seconds for 500 000 commented lines. The only 
difference between the two scripts is the check for a beginning '#' and 
Perl's regular expressions are as optimized as you can get. It should be 
representative of what you'd get in C++.

Bottom line: the difference would not be significant.

- -- 
Simon Perreault <nomis80 at linuxquebec.com>
Web: http://www.linuxquebec.com/~nomis80
PGP: $Web/nomis80.gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9INdEqaCdwBMK2KkRAvAUAJ0Zl2lyQvn4USwzgJ5uWNKrgCwdtwCeKoda
6/OO/kgGeZYDzj0yvJe4f54=
=gUTA
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list