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

Reuse a unique fake StringIO file for CSV generation #373

Merged
merged 1 commit into from
Mar 7, 2016
Merged

Reuse a unique fake StringIO file for CSV generation #373

merged 1 commit into from
Mar 7, 2016

Conversation

davidbgk
Copy link
Member

@davidbgk davidbgk commented Mar 7, 2016

No description provided.

@noirbizarre
Copy link
Contributor

r+ if you're sure that seek(0) + truncate(0) is lighter/faster than a new StringIO instance.

@davidbgk
Copy link
Member Author

davidbgk commented Mar 7, 2016

Actually, it's not faster, I'll update with an explicit del instead ;)

@davidbgk
Copy link
Member Author

davidbgk commented Mar 7, 2016

I might be onto something, with croquemort it's definitely better to use the truncate/seek pattern otherwise the generator is hanging prior to streaming. Checking.

@davidbgk
Copy link
Member Author

davidbgk commented Mar 7, 2016

The results are almost the same so I let the explicit StringIO creation but I added the del because I can't test that for sure.

davidbgk added a commit that referenced this pull request Mar 7, 2016
Reuse a unique fake StringIO file for CSV generation
@davidbgk davidbgk merged commit 46e698d into opendatateam:dev Mar 7, 2016
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.

None yet

2 participants