Currently get_attr_val is called about 10 times for every link.
My proposal is parse attributes in one pass.
To work it needs about 1kB in struct html_context.
Array of such structs will be added to the html_context:
struct attr {
unsigned char *value;
unsigned char *last_changed_by;
} attributes[NUMBER_OF_VARIOUS_ATTRIBS];
Function parse_attributes will parse attributes. For every parsed name
of attribute it will find index in the array using fastfind, set value and set
last_changed_by to start_of_attributes (value of 'a' passed to html_*
functions).
Then in html_* functions instead of get_attr_val will be used such
istructions:
if (a == html_context->attributes[tag].last_changed_by) {
set something using html_context->attributes[tag].value;
/* where tag is appropriate index in the array */
}
Do you think is it worth to implement?
IMO it could speed up a bit parsing big documents with many focusable elements.
Witold Filipczyk
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev