Skip to content

Commit a0af15e

Browse files
authored
Merge pull request #12151 from rouault/speedup_gmlas
GMLAS: speed up parsing by using maps and saving a few memory allocations
2 parents 2eacefa + 1f7c3d2 commit a0af15e

File tree

2 files changed

+249
-179
lines changed

2 files changed

+249
-179
lines changed

ogr/ogrsf_frmts/gmlas/ogr_gmlas.h

+15
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,11 @@ class OGRGMLASLayer final : public OGRLayer
16371637
CPLString
16381638
CreateLinkForAttrToOtherLayer(const CPLString &osFieldName,
16391639
const CPLString &osTargetLayerXPath);
1640+
1641+
const std::map<CPLString, int> &GetMapFieldXPathToOGRFieldIdx() const
1642+
{
1643+
return m_oMapFieldXPathToOGRFieldIdx;
1644+
}
16401645
};
16411646

16421647
/************************************************************************/
@@ -1887,6 +1892,16 @@ class GMLASReader final : public DefaultHandler
18871892
std::map<std::pair<OGRGMLASLayer *, CPLString>, std::vector<CPLString>>
18881893
m_oMapFieldXPathToLinkValue{};
18891894

1895+
/* Map layer's XPath to layer (for layers that are not group) */
1896+
std::map<CPLString, OGRGMLASLayer *> m_oMapXPathToLayer{};
1897+
1898+
/* Map OGR field XPath to layer (for layers that are group) */
1899+
std::map<CPLString, OGRGMLASLayer *> m_oMapFieldXPathToGroupLayer{};
1900+
1901+
/* Map layer's XPath to layer (for layers that are repeated sequences) */
1902+
std::map<CPLString, std::vector<OGRGMLASLayer *>>
1903+
m_oMapXPathToLayerRepeadedSequence{};
1904+
18901905
void SetField(OGRFeature *poFeature, OGRGMLASLayer *poLayer, int nAttrIdx,
18911906
const CPLString &osAttrValue);
18921907

0 commit comments

Comments
 (0)