Skip to content

UTF8 handling slower in 3.x due to ByteString/String conversion #2

Closed

Description

@dalehenrich

glassdb/Seaside31#21 really belongs here, since this is where the work is being done ..

Activity

  1. dalehenrich commented on Jul 3, 2014

    @dalehenrich
    MemberAuthor

    Here is the code for GRUtf8CodecStream>>nextPut: suggested by @obi068:

    GRUtf8CodecStream
    nextPut: aCharacter
        "old implementation is very slow !!"
    "   self nextPutAll: (String with: aCharacter)"
        | codePoint |
        codePoint := aCharacter codePoint.
        codePoint > 127
            ifTrue: [ 
                codePoint > 255
                    ifTrue: [ | enc str |
                            enc := (String with: aCharacter) encodeAsUTF8. 
                             str := String new: enc size.
                            1 to: enc size do: [:idx | str at: idx put: (Character value: (enc at: idx)) ].
                            stream nextPutAll: str ]
                    ifFalse: [ stream nextPutAll: (Latin1ToUtf8Encodings at: codePoint + 1) ] ]
            ifFalse: [ stream nextPut: aCharacter ]
  2. dalehenrich commented on Jul 3, 2014

    @dalehenrich
    MemberAuthor

    Here's the init code for Latin1ToUtf8Encodings:

    UserGlobals at: #Latin1ToUtf8Encodings put: (Array new: 256).
    1 to: 256 do:[ :index | index > 128 ifTrue: [Latin1ToUtf8Encodings at: index put: (String with: (Character codePoint: index - 1)) encodeAsUTF8 asString]  ]
  3. marianopeck commented on Oct 15, 2014

    @marianopeck

    Wow....I have just tried that, and in my case, it produced a performance improvement of 4x. My table rendering decreased from 4s to 1s approx.

  4. dalehenrich commented on Oct 15, 2014

    @dalehenrich
    MemberAuthor

    Unfortunately we were pretty inefficient there ... been inefficient for
    years I guess:)

    On Wed, Oct 15, 2014 at 11:50 AM, marianopeck [email protected]
    wrote:

    Wow....I have just tried that, and in my case, it produced a performance
    improvement of 4x. My table rendering decreased from 4s to 1s approx.

    —
    Reply to this email directly or view it on GitHub
    GsDevKit#2 (comment).

  5. jbrichau commented on Oct 15, 2014

    @jbrichau
    Member

    This never caught my attention because it was tagged for GS3.1, but does it not apply to 2.4 as well?
    Gonna test...

  6. jbrichau commented on Oct 15, 2014

    @jbrichau
    Member

    Even though we're moving up to 3.2 (yes yes... I'm still thinking about that Stella :)

  7. dalehenrich commented on Oct 15, 2014

    @dalehenrich
    MemberAuthor

    I forgot what the Stella bet was! You'd better refresh my memory:)

    On Wed, Oct 15, 2014 at 3:34 PM, Johan Brichau [email protected]
    wrote:

    Even though we're moving up to 3.2 (yes yes... I'm still thinking about
    that Stella :)

    —
    Reply to this email directly or view it on GitHub
    GsDevKit#2 (comment).

  8. jbrichau commented on Oct 16, 2014

    @jbrichau
    Member

    The change to nextPut: doubled performance in my case. And also applying the change to nextPutAll: as you wrote in issue #3 improved the performance another 50% (GS 3.1.0.6).

    @dalehenrich the Stella bet was Yesplan on GS3.2.2 before you worked on the indexing additions you wrote down in your notebook ;)

  9. added a commit that references this issue on Oct 19, 2014
  10. jbrichau commented on Oct 19, 2014

    @jbrichau
    Member

    I added the necessary changes to GRUtf8CodecStream class and moved it entirely to the Grease-GemStone300-Core package. I did the same for the old version of the class and moved that to Grease-GemStone200-Core package (in commit aa8bc1d )

  11. dalehenrich commented on Oct 19, 2014

    @dalehenrich
    MemberAuthor

    sounds good!

    On Sun, Oct 19, 2014 at 9:02 AM, Johan Brichau [email protected]
    wrote:

    I added the necessary changes to GRUtf8CodecStream class and moved it
    entirely to the Grease-GemStone300-Core package. I did the same for the old
    version of the class and moved that to Grease-GemStone200-Core package (in
    commit aa8bc1d
    GsDevKit@aa8bc1d
    )

    —
    Reply to this email directly or view it on GitHub
    GsDevKit#2 (comment).

  12. added a commit that references this issue on Aug 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions