-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSSQLSpatial Fix BCP performance problem (#9112) #9113
Conversation
panSRID = (int *)CPLRealloc(panSRID, sizeof(int) * (nKnownSRID + 1)); | ||
papoSRS = (OGRSpatialReference **)CPLRealloc(papoSRS, sizeof(void *) * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know nothing about this driver, and I see that this is the existing implementation.
But two (!) reallocations for each (!) single SRS doesn't look how I would implement such a cache from scratch today. However, maybe it isn't a bottleneck in the DB context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dg0yt What would be the suggested solution? I don't see a performance issue here, especially because we usually look for only a limited set of SRS-s for each data source (a single one in most cases).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A std::map<int, std::unique_ptr<OGRSpatialReference>> m_oSRSCache
would be the best C++11 replacement for the nKnownSRID, panSRID and papoSRS members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rectification this should be a
std::map<int, std::unique_ptr<OGRSpatialReference, OGRSpatialReferenceReleaser>> m_oSRSCache
so that the free function called is OGRSpatialReference::Release() and not plain delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A std::vector<struct>
with a reasonable reserve
should be fine, thanks to locality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf #9119 for a modernization proposal for the PG driver which uses the same pattern
No description provided.