db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4661) Reduce size of encoding buffer for short character values
Date Fri, 14 May 2010 14:12:42 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867505#action_12867505

Knut Anders Hatlen commented on DERBY-4661:

This looks like a useful improvement. A couple of minor comments:

I think the code would be easier to follow if some of the magic numbers were replaced by constants
or expressions. In particular:

  - the number 10922 could be replaced by bz/3. That would make it clearer where the number
came from, and it would reduce the likelihood of bugs being introduced if we change the default
buffer size later.

  - using a constant (e.g., READ_BUFFER_RESERVATION) instead of the number 6 in ReaderToUTF8Stream's
constructor and in fillBuffer() would make the relation between those methods easier to see.

Perhaps it would be better to call the new method in StreamHeaderGenerator getMaxHeaderLength()?

The call to LimitReader.setLimit() in the lengthless constructor was made redundant by the
patch. Should it be removed?

> Reduce size of encoding buffer for short character values
> ---------------------------------------------------------
>                 Key: DERBY-4661
>                 URL: https://issues.apache.org/jira/browse/DERBY-4661
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions:
>         Environment: Inserts using setXStream(int, Reader/InputStream, int/long) for
short values on character columns
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4661-1a-reduce_encoding_bz.diff, derby-4661-1a-reduce_encoding_bz.stat
> When inserting character values Derby converts from Java char to an on-disk encoding
of UTF-8. To to this, the user stream is read and the resulting bytes after conversion are
placed in a "translation buffer". The default size of the buffer is 32 KB. When inserting
a lot of short values, the pressure on the Java garbage collector is unnecessary high and
the allocation/GC also causes a somewhat higher CPU usage.
> This effect of this issue can easily be reduced by sizing the buffer in the appropriate

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message