Add method iterRecords_range#309
Add method iterRecords_range#309lguez wants to merge 3 commits intoGeospatialPython:masterfrom lguez:master
iterRecords_range#309Conversation
Using iterRecords with a range option should be faster than calling record within a loop, since we avoid the multiple calls to seek.
This reverts commit e41b03c. JamesParrott pointed that I did not understand the way `__record` works: __record does not use oid to find the correct record, it just assumes it is the correct oid for the current position.
Using the method `iterRecords_range` should be somewhat faster than calling the method `record` within a loop, since we avoid the repeated calls to seek inside `record`.
|
Great stuff - thanks Lionel :). This appears to be good from a quick look - I'll review it fully over the next few days and get back to you. |
|
OK. Thanks. I have written a separate method because you said you prefered so, but I still think it would make simpler code and it would be clearer to the user to have additional optional arguments to the iterRecords method: |
|
Yeah, adjusting iterRecords is more sensible if the range iterator is not customisable, just start and stop (in future, step could be added too). It avoids duplication. How's this look? [edit] I added one test, and the branch above passes it (and also passes all the previous ones). I think "yields the same Can you, or anyone, think of anything else that should be tested? |
|
No, it seems fine. Thanks. |
|
A branch has been made from this PR, which will be merged: https://github.com/GeospatialPython/pyshp/tree/combine_iterRecords_range_into_iterRecords |
I have tested this by reading about one million record:
I get:
So
iterRecords_rangeis somewhat faster.