You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sl...@apache.org on 2018/05/04 18:45:45 UTC

[incubator-daffodil] branch master updated (4160a2f -> 66b2017)

This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git.


 discard 4160a2f  fixup! Fix performance regression in layering feature
 discard f2b9088  Fix performance regression in layering feature
     new 66b2017  Fix performance regression in layering feature

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4160a2f)
            \
             N -- N -- N   refs/heads/master (66b2017)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
slawrence@apache.org.

[incubator-daffodil] 01/01: Fix performance regression in layering feature

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git

commit 66b20173a1a92fcfd0688f87b4cb01d2e5adff84
Author: Steve Lawrence <sl...@apache.org>
AuthorDate: Fri May 4 10:10:45 2018 -0400

    Fix performance regression in layering feature
    
    Commit 1ea2290f28 changed how the input data was copied to a
    ByteArrayOutputStream by coping byte-by-byte rather than use
    IOUtils.copy(). The byte-by-byte change was useful for debugging, but
    caused a noticeable performance hit since IOUtils.copy() can copy in
    chunks. Revert the change to bring back the performance.
    
    DAFFODIL-1933
---
 .../scala/org/apache/daffodil/io/ByteBufferDataInputStream.scala | 9 ++-------
 .../scala/org/apache/daffodil/layers/LineFoldedTransformer.scala | 1 +
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/daffodil-io/src/main/scala/org/apache/daffodil/io/ByteBufferDataInputStream.scala b/daffodil-io/src/main/scala/org/apache/daffodil/io/ByteBufferDataInputStream.scala
index 7ded5ff..c1e01e9 100644
--- a/daffodil-io/src/main/scala/org/apache/daffodil/io/ByteBufferDataInputStream.scala
+++ b/daffodil-io/src/main/scala/org/apache/daffodil/io/ByteBufferDataInputStream.scala
@@ -23,6 +23,7 @@ import org.apache.daffodil.schema.annotation.props.gen.UTF16Width
 import org.apache.daffodil.schema.annotation.props.gen.BitOrder
 import org.apache.daffodil.schema.annotation.props.gen.ByteOrder
 import java.nio.charset.CodingErrorAction
+import org.apache.commons.io.IOUtils
 import java.io.ByteArrayOutputStream
 import java.nio.ByteBuffer
 import org.apache.daffodil.exceptions.Assert
@@ -90,13 +91,7 @@ object ByteBufferDataInputStream {
       case _ => {
         // copy the contents of the stream into an array of bytes
         val bos = new ByteArrayOutputStream
-        var b: Int = 0
-        while ({
-          b = in.read()
-          b != -1
-        }) {
-          bos.write(b)
-        }
+        IOUtils.copy(in, bos)
         bos.flush()
         bos.close()
         in.close()
diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LineFoldedTransformer.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LineFoldedTransformer.scala
index 7b659ec..48d388b 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LineFoldedTransformer.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/layers/LineFoldedTransformer.scala
@@ -254,6 +254,7 @@ class LineFoldedInputStream(mode: LineFoldMode, jis: InputStream)
    */
   override def read(): Int = {
     import State._
+    if (state eq Done) return -1
     while (state != Done) {
       state match {
         case Start => {

-- 
To stop receiving notification emails like this one, please contact
slawrence@apache.org.