Issue 3383 in pharo: [FIX] make String >> #subStrings: do less allocation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3383 in pharo: [FIX] make String >> #subStrings: do less allocation

pharo
Status: Accepted
Owner: philippe.marschall
Labels: Type-Patch Difficulty-Easy Importance-Low

New issue 3383 by philippe.marschall: [FIX] make String >> #subStrings: do  
less allocation
http://code.google.com/p/pharo/issues/detail?id=3383

String >> #subStrings: does a lot of allocation. It allocates a new string  
for almost every character. So if you do something  
like '/alongUrl/withaPathElement/andSomethingMore' subStrings: '/' about  
forty strings are allocated. This can easily be avoided using write streams.

The method could probably be made even faster by using  
#indexOfSubCollection:startingAt: and just copying with the correct size.

I will post a patch but I first need an issue number that I can reference.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3383 in pharo: [FIX] make String >> #subStrings: do less allocation

pharo
Updates:
        Status: Fixed

Comment #1 on issue 3383 by philippe.marschall: [FIX] make String >>  
#subStrings: do less allocation
http://code.google.com/p/pharo/issues/detail?id=3383

Name: SLICE-Issue-3383-FIX-make-String--subStrings-do-less-allocation-Pmm.1
Author: Pmm
Time: 5 December 2010, 2:49:47 pm
UUID: 1c8f3fad-367b-4357-9d39-c06f0fc59290
Ancestors:
Dependencies: Collections-Strings-Pmm.163, CollectionsTests-Pmm.492

- Issue 3383: [FIX] make String >> #subStrings: do less allocation


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3383 in pharo: [FIX] make String >> #subStrings: do less allocation

pharo
Updates:
        Status: closed

Comment #2 on issue 3383 by stephane.ducasse: [FIX] make String >>  
#subStrings: do less allocation
http://code.google.com/p/pharo/issues/detail?id=3383

in 12271