[ALOY-27] Improve HTML parsing performance
|Affected Version/s||2012 Sprint 14|
|Fix Version/s||2012 Sprint 14|
DescriptionRight now, everytime the generated HTML parser
parser/html.jsis called in
parser/parser.js, the entire document is parsed. We should not be making multiple calls to
html.parser(), we should either be processing all relevant HTML elements in a single call to
html.parser(), or make use of the different
startRulevalues available in
parser/html.js. This may not be an issue now, but as apps grow more complex, inefficient parsing could adversely effect build time.
- Russell McMahon 2012-05-11 Already built into the parsing is passing in an already created object tree, so no need to parse every time . Needs testing though.
- Tony Lukasavage 2012-05-11 Right, but wouldn't you need to traverse the object tree to know what to pass in? Since the object tree corresponds to our custom HTML grammar, there's no easy/efficient way to use selectors to traverse it.
- Russell McMahon 2012-05-11 You can also pass in parts so it limits what is scanned. As to selectors something you do need to scan the whole tree to return a collection but in the case of id once the object is created it's a hash map lookup so no dom scanning.
- Tony Lukasavage 2012-05-21 details here: [https://github.com/appcelerator/ZipTi/commit/cde130b26b91a1eb5f9d08bfc1ac0e9df7d4a9a6](https://github.com/appcelerator/ZipTi/commit/cde130b26b91a1eb5f9d08bfc1ac0e9df7d4a9a6)