Version 4 (modified by 17 years ago) ( diff ) | ,
---|
RFC 13: Improved Feature Insertion Performance
Author: Konstantin Baumann
Contact: baumann@…
Status: Proposed
Summary
Some OGR drivers can dramatically increase the speed of and optimize the insertion of a set of features, if the driver knows, that there is a whole set of features that should/could be inserted at once (instead of just one by one).
CreateFeatures()
The following new virtual method is added to the OGRLayer class, with an analogous C function:
virtual OGRErr CreateFeatures( OGRFeature** papoFeatures, int iFeatureCount );
A default implementation is given as below:
OGRErr OGRLayer::CreateFeatures( OGRFeature **papoFeatures, int iFeatureCount ) { for(int i = 0; i < iFeatureCount; ++i) { OGRErr error = CreateFeature( papoFeatures[i] ); if( error != OGRERR_NONE ) return error; } return OGRERR_NONE; }
This triggers the old behavior of an unoptimized insertion.
Individual drivers can override the default implementation and can implement an optimized algorithm for inserting a set of features.
Additional Notes
Based in this new interface function, I was able to increase the insertion speed of features in the MySQL driver from 40 per second to up to 800-2000 per second. I think other drivers can benefit from this change, too.
See also ticket #1633.
Implementation Plan
A patch for the describe additions can be trivially provided.
I can provide another patch based on this interface which contains the optimized implementation for the MySQL driver.