[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] getaline() (once more)

krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx (Cornelius Krasel) writes:
> Matthias Andree wrote:
> > I did not see what was wrong with my getline/getaline implementation,
> IIRC you suspected that your getaline implementation was very slow.

I did some benchmarking on my machine (a Celeron with 400 MHz and 64 MB
RAM). Both versions of getaline had to read a textfile of a million lines,
each 60 chars long, via stdin. The 2.0b7 version of getaline needed between
4.0 and 5.0 seconds for this; the getaline version from 1.9.17ma3 took
between 10.9 and 12.0 seconds.

Here are some more details:


real    0m4.002s    0m4.006s    0m4.997s    0m4.102s    0m4.224s
user    0m2.020s    0m1.860s    0m2.070s    0m1.980s    0m1.900s
sys     0m0.350s    0m0.420s    0m0.360s    0m0.400s    0m0.500s


real    0m10.909s   0m11.227s   0m11.991s   0m10.942s   0m11.013s
user    0m9.700s    0m9.580s    0m9.580s    0m9.630s    0m9.640s
sys     0m0.300s    0m0.450s    0m0.450s    0m0.370s    0m0.350s

The program was:

int main( void ) {
    char *l;
    int i = 0;
    while ((l = getaline(stdin))!= NULL) {
    return 0;

I suspect one could live with a loss of about 60% of speed since the
"ma" version still is able to read a line in approx. 11 microseconds.
The bottleneck is probably not the speed of getaline() but the speed of
the network connection, and this will even be true for a 486.

This leaves the question of licensing. Matthias' getaline() is licensed
under the GNU Public license. This would require to put leafnode-2.0
also under the GPL. While I am not a close friend of the GNU foundation,
I don't have problems with the GPL but I wonder what other people on
this list think.


/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany   email: krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx */
/* "Science is the game we play with God to find out what His rules are."  */

leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list