Titanium JIRA Archive
Alloy (ALOY)

[ALOY-27] Improve HTML parsing performance

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-19T11:52:06.000+0000
Affected Version/s2012 Sprint 14
Fix Version/s2012 Sprint 14
ComponentsXML
Labelsn/a
ReporterTony Lukasavage
AssigneeTony Lukasavage
Created2012-05-11T08:24:31.000+0000
Updated2014-06-22T13:21:20.000+0000

Description

Right now, everytime the generated HTML parser parser/html.js is 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 startRule values 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.

Comments

  1. 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.
  2. 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.
  3. 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.
  4. Tony Lukasavage 2012-05-21

    details here: [https://github.com/appcelerator/ZipTi/commit/cde130b26b91a1eb5f9d08bfc1ac0e9df7d4a9a6](https://github.com/appcelerator/ZipTi/commit/cde130b26b91a1eb5f9d08bfc1ac0e9df7d4a9a6)

JSON Source