pjfanning opened a new pull request, #1361: URL: https://github.com/apache/poi/pull/1361
Follow-up to #1360. The `List` returned by xmlbeans' `getXxxList()` is a live view (`JavaListXmlObject`). Its `get(i)` delegates to `getXxxArray(i)`, which walks the children, so iterating it is quadratic. That applies to for-each loops, `stream()`, `forEach`, `get(i)` in loops, `indexOf` and `remove(Object)` alike. This PR changes read-only uses in poi-ooxml main code to fetch `getXxxArray()` once: - **for-each / forEach:** POIXMLProperties, POIXMLPropertiesTextExtractor, XWPF footnotes/endnotes/comments/run/paragraph SDT runs/`insertTable` lookups, XSSFSheet (table formulas, row rebuild, ignored errors), XSSFRowColShifter anchors, XSSFTableStyle, XSLFTable, XSLFTableStyles, XMLSlideShow masters/slides, XSLFDiagram, and the XDDF chart-data constructors' `getSerList()` loops. - **`get(i)` in loops:** XSSFSheet table cloning (totals row and calculated column formulas) and CustomIndexedColorMap. - **`stream()`:** the XDDF list getters (dash stops, geometry guides/handles/paths, gradient stops, tab stops, text paragraphs, legend entries). - **`indexOf`:** XWPFTable row insert/remove now uses `Arrays.asList(getTrArray())`. - **`remove(Object)`:** XSLFSheet/XSLFGroupShape `removeShape` now finds the index in the array and calls `removeXxx(i)`, via a small package-private helper. xmlbeans objects don't override `equals`, so the identity check matches the old behaviour. Not changed: - uses that mutate through the list (e.g. `XDDFChartData.Series.getDPtList()` callers, `groupShapeCt.getSpList().addAll`, `getColorList().clear()`); - POI's own `getXxxList()` methods (footnotes, hyperlinks, XDGF pages); - the deliberate `getClientDataList().toString()` workaround in XSSFComment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
