[Pharo-project] Streams. Status and where to go?

Igor Stasenko siguctua at gmail.com
Sun Feb 28 08:18:51 EST 2010


On 28 February 2010 14:33, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> 2010/2/28 Igor Stasenko <siguctua at gmail.com>:
>> On 28 February 2010 12:45, Nicolas Cellier
......
>
> Anyway, main contributor of UTF8Decoder inefficiency is
> Unicode>>value: and leadingChar handling:
>

btw, why its using #value: , not more efficient charFromUnicode: ?

value: code

	| l |
	code < 256 ifTrue: [^ Character value: code].
	l := Locale currentPlatform languageEnvironment leadingChar.
	l = 0 ifTrue: [l := 255].
	^ Character leadingChar: l code: code.

for unicode leadingChar is always 255 (see Unicode>>leadingChar)

So, i'm not sure what this code with Locale doing here?

Btw, converter could use a 'leadingChar' ivar, which can be initialized to
Locale currentPlatform languageEnvironment leadingChar. (if this correct),
or Unicode>>leadingChar , which i feel more correct.

And then just build chars by own, without using Unicode global:
  Character leadingChar: leadingChar code: uniCode



> | str |
> str := (StandardFileStream readOnlyFileNamed: 'unitext.txt') readXtream binary.
> MessageTally spyOn:
> [ (UTF8Decoder new source: str readXtream buffered)
> buffered upToEnd ]
>
>
>  - 133 tallies, 133 msec.
>
> **Tree**
> --------------------------------
> Process: (40) 37486: nil
> --------------------------------
> 99.2% {132ms} BufferedReadXtream>>checkAvailableDataInBuffer
>  99.2% {132ms} BufferedReadXtream>>readNextBuffer
>    99.2% {132ms} UTF8Decoder(CharacterDecoder)>>readInto:startingAt:count:
>      50.4% {67ms} UTF8Decoder>>next
>        |45.1% {60ms} Unicode class>>value:
>        |  |30.1% {40ms} Locale>>languageEnvironment
>        |  |  |29.3% {39ms} LanguageEnvironment class>>localeID:
>        |  |  |  29.3% {39ms} Dictionary>>at:ifAbsent:
>        |  |  |    27.1% {36ms} Dictionary>>scanFor:
>        |  |  |      |15.0% {20ms} LocaleID>>=
>        |  |  |      |  |6.0% {8ms} UndefinedObject(Object)>>=
>        |  |  |      |  |6.0% {8ms} primitives
>        |  |  |      |  |3.0% {4ms} ByteString(String)>>=
>        |  |  |      |  |  2.3% {3ms} primitives
>        |  |  |      |9.8% {13ms} LocaleID>>hash
>        |  |  |      |  |6.8% {9ms} ByteString(String)>>hash
>        |  |  |      |  |2.3% {3ms} UndefinedObject(Object)>>hash
>        |  |  |      |  |  1.5% {2ms} primitives
>        |  |  |      |2.3% {3ms} primitives
>        |  |  |    2.3% {3ms} primitives
>        |  |9.8% {13ms} Character class>>leadingChar:code:
>        |  |  |5.3% {7ms} Character class>>value:
>        |  |  |  |3.0% {4ms} primitives
>        |  |  |  |2.3% {3ms} Character>>setValue:
>        |  |  |4.5% {6ms} primitives
>        |  |2.3% {3ms} primitives
>        |  |1.5% {2ms} Latin1Environment(LanguageEnvironment)>>leadingChar
>        |  |1.5% {2ms} Locale class>>currentPlatform
>        |3.0% {4ms} CollectionReadXtream>>next
>        |2.3% {3ms} primitives
>      18.8% {25ms} UTF8Decoder(CharacterDecoder)>>readInto:startingAt:count:
>        |9.8% {13ms} UTF8Decoder>>next
>        |  |9.0% {12ms} Unicode class>>value:
>        |  |  6.0% {8ms} Locale>>languageEnvironment
>        |  |    |5.3% {7ms} LanguageEnvironment class>>localeID:
>        |  |    |  5.3% {7ms} Dictionary>>at:ifAbsent:
>        |  |    |    5.3% {7ms} Dictionary>>scanFor:
>        |  |    |      3.0% {4ms} LocaleID>>=
>        |  |    |        |1.5% {2ms} UndefinedObject(Object)>>=
>        |  |    |        |1.5% {2ms} ByteString(String)>>=
>        |  |    |        |  1.5% {2ms}
> ByteString(String)>>compare:with:collated:
>        |  |    |      2.3% {3ms} LocaleID>>hash
>        |  |    |        1.5% {2ms} UndefinedObject(Object)>>hash
>        |  |  2.3% {3ms} Latin1Environment(LanguageEnvironment)>>leadingChar
>        |5.3% {7ms} UTF8Decoder(CharacterDecoder)>>readInto:startingAt:count:
>        |  |3.0% {4ms} UTF8Decoder>>next
>        |  |  |3.0% {4ms} Unicode class>>value:
>        |  |  |  2.3% {3ms} Locale>>languageEnvironment
>        |  |  |    2.3% {3ms} LanguageEnvironment class>>localeID:
>        |  |  |      2.3% {3ms} Dictionary>>at:ifAbsent:
>        |  |  |        2.3% {3ms} Dictionary>>scanFor:
>        |  |1.5% {2ms} UTF8Decoder(CharacterDecoder)>>readInto:startingAt:count:
>        |2.3% {3ms} ByteArray(SequenceableCollection)>>readXtreamFrom:to:
>        |  1.5% {2ms} CollectionReadXtream class>>read:from:to:
>        |    1.5% {2ms} CollectionReadXtream>>read:from:to:
>      13.5% {18ms} ByteArray(SequenceableCollection)>>readXtreamFrom:to:
>        |10.5% {14ms} CollectionReadXtream class>>read:from:to:
>        |  |6.8% {9ms} CollectionReadXtream>>read:from:to:
>        |  |  |3.0% {4ms} primitives
>        |  |  |2.3% {3ms} SmallInteger(Magnitude)>>max:
>        |  |  |1.5% {2ms} SmallInteger(Magnitude)>>min:
>        |  |2.3% {3ms} CollectionReadXtream class(Behavior)>>new
>        |  |1.5% {2ms} primitives
>        |3.0% {4ms} primitives
>      3.8% {5ms} Unicode class>>value:
>        |3.0% {4ms} primitives
>      2.3% {3ms} CollectionReadXtream>>position
>      2.3% {3ms} CollectionReadXtream(ReadXtream)>>endOfStreamAction:
>      2.3% {3ms} primitives
>      1.5% {2ms} ByteString>>at:put:
>      1.5% {2ms} WideString class(Behavior)>>isBytes
>      1.5% {2ms} UTF8Decoder(ReadXtream)>>source:
>      1.5% {2ms} WideString>>at:put:
>
> **Leaves**
> 7.5% {10ms} UndefinedObject(Object)>>=
> 6.8% {9ms} LocaleID>>=
> 6.8% {9ms} ByteString(String)>>hash
> 6.0% {8ms} Unicode class>>value:
> 4.5% {6ms} Character class>>leadingChar:code:
> 3.8% {5ms} CollectionReadXtream>>position
> 3.8% {5ms} CollectionReadXtream>>read:from:to:
> 3.8% {5ms} ByteArray(SequenceableCollection)>>readXtreamFrom:to:
> 3.8% {5ms} CollectionReadXtream>>next
> 3.8% {5ms} Latin1Environment(LanguageEnvironment)>>leadingChar
> 3.8% {5ms} Character class>>value:
> 3.0% {4ms} UndefinedObject(Object)>>hash
> 3.0% {4ms} WideString>>at:put:
> 3.0% {4ms} Dictionary>>scanFor:
> 3.0% {4ms} SmallInteger(Magnitude)>>max:
> 3.0% {4ms} Character>>setValue:
> 3.0% {4ms} UTF8Decoder(CharacterDecoder)>>readInto:startingAt:count:
> 2.3% {3ms} CollectionReadXtream(ReadXtream)>>endOfStreamAction:
> 2.3% {3ms} UndefinedObject(ProtoObject)>>scaledIdentityHash
> 2.3% {3ms} UTF8Decoder>>next
> 2.3% {3ms} ByteString(String)>>compare:with:collated:
> 2.3% {3ms} Dictionary>>at:ifAbsent:
> 2.3% {3ms} CollectionReadXtream class(Behavior)>>new
> 2.3% {3ms} ByteString(String)>>=
> 1.5% {2ms} Locale class>>currentPlatform
> 1.5% {2ms} LocaleID>>hash
> 1.5% {2ms} Locale>>languageEnvironment
> 1.5% {2ms} UTF8Decoder(ReadXtream)>>source:
> 1.5% {2ms} CollectionReadXtream class>>read:from:to:
> 1.5% {2ms} SmallInteger(Magnitude)>>min:
>
> **Memory**
>        old                     +0 bytes
>        young           -454,224 bytes
>        used            -454,224 bytes
>        free            +454,224 bytes
>
> **GCs**
>        full                    0 totalling 0ms (0.0% uptime)
>        incr            15 totalling 14ms (11.0% uptime), avg 1.0ms
>        tenures         0
>        root table      0 overflows
>
>
>>>>> Nicolas
>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> Igor Stasenko AKA sig.
>>>>>>
>>>>>> _______________________________________________
>>>>>> Pharo-project mailing list
>>>>>> Pharo-project at lists.gforge.inria.fr
>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-project mailing list
>>>>> Pharo-project at lists.gforge.inria.fr
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Igor Stasenko AKA sig.
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project at lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> Pharo-project at lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list