Re: Premature optimization

Kalle Olavi Niemitalo <[email protected]> Tue, 14 Oct 2008 22:47:13 +0300
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
Witold Filipczyk <[email protected]> wrote a few months ago:

> I read in the zziplib docs that a conditional call is ten times slower
> than an uncoditional one. Is it true?

Even if it is true for calls to known functions, it might not be
true for calls via function pointers.

> In src/document/html/parser/parse.c (start_element, end_element)
> there are:
> if (ei->open) ei->open()
> and
> if (ei->close) ei->close()
>
> Wouldn't be ELinks faster and simpler if all (close and open) functions
> be defined?

Measure it and see?
Bug 545 comment 8 shows that 78% of time was spent in CSS.
I expect this change would have a negligible effect on speed.

The calls would be a bit simpler, but there are only two of them,
so it doesn't matter much for readability.
However, the elements[] array might become a bit harder to read
if you replaced NULLs with some html_noop function pointers.
Currently, the few html_*_close functions stand out really well.
Anyway, if you want to make this change, it's OK with me.

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI9PdGHm9IGt60eMgRArrFAJ9rCEmi3GRVjbhmEilIXJj4kAOzcQCeNbiw
O4e/cbZxvNBcdFL3wiGilwM=
=XfPy
-----END PGP SIGNATURE-----