[ 
https://issues.apache.org/jira/browse/DERBY-3934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kristian Waagan updated DERBY-3934:
-----------------------------------

    Attachment: derby-3934-4a-getinternalreader_cachedlength.diff

Patch 'derby-3934-4a-getinternalreader_cachedlength.diff' improves the 
performance of Clob.getSubString when the Clob is represented by a 
TemporaryClob.

The main change in the patch is the implementation of 
TemporaryClob.getInternalReader(long).
The second important change is that TemporaryClob now caches the character 
length. When the contents are changed, the length is either reset or updated 
accordingly if possible.
I also added some length to verify that the length is correctly updated on Clob 
modifications.

On my machine I see the following durations (one iteration) for 
ClobAccessTest.testFetchLargeClobPieceByPieceModified:
trunk ~76'000 ms
with patch 4a ~600 ms
So with the patch the test completes in less than 1% of the time used by trunk. 
This is saved CPU time.

Regressing tests are running.
Patch ready for review.

> Improve performance of reading modified Clobs
> ---------------------------------------------
>
>                 Key: DERBY-3934
>                 URL: https://issues.apache.org/jira/browse/DERBY-3934
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>         Attachments: derby-3934-1a-clob_replace_test.diff, 
> derby-3934-2a-intclob_new_methods.diff, 
> derby-3934-3a-clobupdreader_utf8reader.diff, 
> derby-3934-3a-clobupdreader_utf8reader.stat, 
> derby-3934-4a-getinternalreader_cachedlength.diff
>
>
> The performance of reading modified Clobs is poor, which is demonstrated by 
> running a test program selecting a 10 MB Clob and then getting the contents 
> using getSubString:
>  - unmodified Clob (StoreStreamClob) : ~1 300 ms
>  - modified Clob (TemporaryClob): ~156 000 ms
> In this case, the Clob was modified by changing the first character.
> A number of subtasks will be created to handle the various issues, which will 
> be related to both performance and code cleanup.
> For a brief overview, see 
> http://www.nabble.com/Suggestion-for-improving-ClobUpdatableReader-and-related-code-to20308303.html

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

Reply via email to