Ticket #145 (new enhancement)
Cache nodes xpath when parsing document
| Reported by: | lfrittelli | Owned by: | ser |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | DOM | Version: | 3.1.6 |
| Severity: | normal | Keywords: | |
| Cc: | leonardo.frittelli@… | Ruby version: | 1.8.5 |
| Operating system: | Linux |
Description
Node xpath calculation is time expensive, particularly when calculating the xpath of a node that is an item in a large list of children. ReXML performs this calculation every time element.xpath is invoked (see def xpath() in element.rb) Also, obtaining a node's xpath is more expensive to perform after the tree is created than doing that while the tree is being parsed (because of the need to fetch for siblings to determine if a suffix is needed) Would you consider calculating nodes' xpath and storing it in an instance variable when the document is parsed? This would produce a great benefit in overall ReXML performance at a relatively low cost.
