Changes between Initial Version and Version 1 of rfc13_createfeatures


Ignore:
Timestamp:
May 14, 2007, 8:11:53 AM (17 years ago)
Author:
Kosta
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • rfc13_createfeatures

    v1 v1  
     1'''RFC 12: Improved File Management'''
     2
     3    Author: Konstantin Baumann[[BR]]
     4    Contact: baumann@hpi.uni-potsdam.de[[BR]]
     5    Status: Proposed
     6
     7'''Summary'''
     8
     9Some 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).
     10
     11'''!CreateFeatures()'''
     12
     13The following new virtual method is added to the OGRLayer class, with an analogous C function:
     14{{{
     15virtual OGRErr CreateFeatures( OGRFeature** papoFeatures, int iFeatureCount );
     16}}}
     17
     18A default implementation is given as below:
     19{{{
     20OGRErr OGRLayer::CreateFeatures(
     21    OGRFeature **papoFeatures,
     22    int iFeatureCount
     23) {
     24    for(int i = 0; i < iFeatureCount; ++i) {
     25        OGRErr error = CreateFeature( papoFeatures[i] );
     26        if( error != OGRERR_NONE ) return error;
     27    }
     28    return OGRERR_NONE;
     29}
     30}}}
     31
     32This triggers the old behavior of an unoptimized insertion.
     33
     34Individual drivers can override the default implementation and can implement an optimized algorithm for inserting a set of features.
     35
     36'''Additional Notes'''
     37
     38Based 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.
     39
     40'''Implementation Plan'''
     41
     42A patch for the describe additions can be trivially provided.
     43
     44I can provide another patch based on this interface which contains the optimized implementation for the MySQL driver.