SA Bugzilla – Bug 2101
HTML parser is run up to 4 times per message
Last modified: 2004-01-24 11:48:16 UTC
This is not a good thing since it probably affects some of the HTML tests (changing results depending on how many times it's called and when and with which options turned on or off). Worse, it slows stuff down. 1. get_content_preview() calls get_decoded_stripped_body_text_array() which renders the entire HTML document again. This is probably the worst of the lot since it doesn't even need the entire HTML document. We could just save off a relatively small hunk of text the first time we run get_decoded_stripped_body_text_array(). 2. Bayes also calls get_decoded_stripped_body_text_array() 3. PerMsgStatus also has another repeat of the call. I think this one has been here longer. I don't remember HTML::Parser running more than once per message back when I put it in originally, but that was a while ago, so maybe I've forgotten.
Subject: Re: [SAdev] New: HTML parser is run up to 4 times per message > 1. get_content_preview() calls get_decoded_stripped_body_text_array() which > renders the entire HTML document again. This is probably the worst of the > lot since it doesn't even need the entire HTML document. We could just > save off a relatively small hunk of text the first time we run > get_decoded_stripped_body_text_array(). true. > 2. Bayes also calls get_decoded_stripped_body_text_array() BTW are the results of this not cached? They used to be, and they should be. --j.
Subject: Re: HTML parser is run up to 4 times per message > BTW are the results of this not cached? They used to be, and they > should be. Well, there's only one return statement and it's at the end of the function.
Subject: Re: [SAdev] HTML parser is run up to 4 times per message > Well, there's only one return statement and it's at the end of the > function. Alright... so we just need to cache it :-)
this is all fixed in 2.70, html is only rendered once, and content preview gets a cached version of the rendered output.