Skip to content

Update test_strings.py#1

Open
obeleh wants to merge 1 commit into
eGenix:masterfrom
obeleh:patch-1
Open

Update test_strings.py#1
obeleh wants to merge 1 commit into
eGenix:masterfrom
obeleh:patch-1

Conversation

@obeleh

@obeleh obeleh commented Jan 31, 2015

Copy link
Copy Markdown

I've just seen your talk at FOSDEM and you mentioned cStringIO wasn't that fast. I just recenlty did some performance testing with it and my conclusion was that it's only fast when it has to handle a lot of data/iterations. My guess is that it's due to many memory reallocations that the string_concat has to do.

On my machine the "boundary" is about 200k iterations. I've made the example 1M iterations so that the speedup shows its' advantage

Timing function string_concat_more():
10 loops, best of 3: 1.94 sec per loop

Timing function string_cstringio_more():
10 loops, best of 3: 382 msec per loop

I've just seen your talk at FOSDEM and you mentioned cStringIO wasn't that fast. I just recenlty did some performance testing with it and my conclusion was that it's only fast when it has to handle a lot of data/iterations. My guess is that it's due to many memory reallocations that the string_concat has to do.

On my machine the "boundary" is about 200k iterations. I've made the example 1M iterations so that the speedup shows its' advantage 

Timing function string_concat_more():
10 loops, best of 3: 1.94 sec per loop  

Timing function string_cstringio_more():
10 loops, best of 3: 382 msec per loop
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.

1 participant