Skip to content
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

Don't call Pipeline::valid() recursively when a row is discarded #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ollyollyollyltd
Copy link

Currently, when a row is discarded (e.g. by the Transformer), the Pipeline::valid function manually increments the current key, then calls itself recursively. When discarding many rows, this not only leads to extremely deep call stacks, it also seems to cause execution time to grow linearly as extraction loop progresses.

By changing the discarded behaviour to a simple break; statement the valid function will simply return true, bypassing subsequent steps (e.g. the Loader) and progressing on to the next row without recursion.

Currently, when a row is discarded (e.g. by the Transformer), the Pipeline::valid function manually increments the current key, then calls itself recursively.  When discarding many rows, this not only leads to extremely deep call stacks, it also seems to cause execution time to grow linearly as extraction loop progresses.

By changing the discarded behaviour to a simple `break;` statement the valid function will simply return `true`, bypassing subsequent steps (e.g. the Loader) and progressing on to the next row without recursion.
@ollyollyollyltd
Copy link
Author

NB. I cannot see any reason why the recursion behaviour was included in the first place; if I have misunderstood, please let me know.

@ecourtial
Copy link
Collaborator

Thank you @ollyollyollyltd for this input!
Could you have a look to the unit tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants