git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Resolved] (DAFFODIL-1933) Performance regression with new Base64/Layering changes


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

Steve Lawrence resolved DAFFODIL-1933.
--------------------------------------
    Resolution: Fixed
      Assignee: Dave Thompson  (was: Steve Lawrence)

Fixed in 66b20173a1a92fcfd0688f87b4cb01d2e5adff84

> Performance regression with new Base64/Layering changes
> -------------------------------------------------------
>
>                 Key: DAFFODIL-1933
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1933
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>            Reporter: Steve Lawrence
>            Assignee: Dave Thompson
>            Priority: Critical
>             Fix For: 2.2.0
>
>
> Nightly tests showed a fairly drastic performance regression (50% reduction in speed) in commit 1ea2290f28: All properties for Base64/layering implemented.
> Skimming the code, one change jumped out at me as a likely cause in ByteBufferDataInputStream.scala:
> {code:language=diff}
> @@ -91,7 +90,13 @@ object ByteBufferDataInputStream {
>        case _ => {
>          // copy the contents of the stream into an array of bytes
>          val bos = new ByteArrayOutputStream
> -        IOUtils.copy(in, bos)
> +        var b: Int = 0
> +        while ({
> +          b = in.read()
> +          b != -1
> +        }) {
> +          bos.write(b)
> +        }
>          bos.flush()
>          bos.close()
>          in.close()
> {code}
> This changes the copy from a bulk copy to a byte-by-byte copy, which appears to have pretty drastic performance. A few simple quick tests shows that reverting this change recovers all performance losses.
> Mike, can you confirm if this change can be reverted, or if there was some other reason related to layering to switch to a byte-by-byte copy?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)