[Pharo-project] Issue 3360 in pharo: TextConverter handling of binary streams is wrong

pharo at googlecode.com pharo at googlecode.com
Tue Nov 30 14:51:42 CET 2010


Comment #1 on issue 3360 by sven.van.caekenberghe: TextConverter handling  
of binary streams is wrong
http://code.google.com/p/pharo/issues/detail?id=3360

ZnUTF8Encoder seems about 20% faster than UTF8Converter based on the  
following benchmark (which adds too many characters with multibyte  
encodings I guess):

[ 100 timesRepeat: [ZnCharacterEncoderTests new testUTF8EncoderAuto] ]  
timeToRun.

[ 100 timesRepeat:
[ | in tmp out |
in := String withAll: ((1 to: 3072) collect: [ :each | Character value:  
each ]).
tmp := in convertToWithConverter: UTF8TextConverter new.
out := tmp convertFromWithConverter: UTF8TextConverter new.
self assert: in = out ] ] timeToRun.

Note that tmp is a ByteString not a ByteArray..

Sven







More information about the Pharo-project mailing list