You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by DaGeRe <gi...@git.apache.org> on 2017/10/11 15:52:37 UTC

[GitHub] maven-surefire pull request #167: Speedup Standard Output if Tests

GitHub user DaGeRe opened a pull request:

    https://github.com/apache/maven-surefire/pull/167

    Speedup Standard Output if Tests

    Currently, surefire creates a new byte array with size of the input *3 for saving the unescaped input. This made surefire way slower than running a test directly in eclipse or with gradle, if it used standardout or error heavily.
    By using a list for saving the elements and converting them to an array afterwards, this problem is solved, and stdout-heavy surefire tests get faster.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/DaGeRe/maven-surefire master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/maven-surefire/pull/167.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #167
    
----

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    @DaGeRe 
    Close this PR!


---

[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    @DaGeRe 
    Pls run the build `mvn install -P run-its "-Djdk.home=e:\Program Files\Java\jdk9\"` with default JDK 8 and additional JDK9 for few tests as you can see in system property `jdk.home`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    Did you test it with Ubuntu UTF-8 and on Windows with encoding 1252 and with special characters and some language dialects as well?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by DaGeRe <gi...@git.apache.org>.
Github user DaGeRe commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    I adjusted the current commit and PR to code style, could you re-review this one?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire pull request #167: Speedup Standard Output if Tests

Posted by DaGeRe <gi...@git.apache.org>.
Github user DaGeRe closed the pull request at:

    https://github.com/apache/maven-surefire/pull/167


---

[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by DaGeRe <gi...@git.apache.org>.
Github user DaGeRe commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    I did not create a ticket, is this recommended? https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch only covers patching in SVN..
    
    I did not test it with other encodings. I will do so and report.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    Pls do it in a new PR. Here is link for Eclipse/Idea code style xml
    https://maven.apache.org/developers/conventions/code.html
    
    On Wed, Oct 11, 2017 at 8:24 PM, Tibor Digana <ti...@googlemail.com>
    wrote:
    
    > You completely changed code style.
    > Please use ASF Maven code style because here I do not see relevant changes.
    >
    > On Wed, Oct 11, 2017 at 5:52 PM, DaGeRe <no...@github.com> wrote:
    >
    >> Currently, surefire creates a new byte array with size of the input *3
    >> for saving the unescaped input. This made surefire way slower than running
    >> a test directly in eclipse or with gradle, if it used standardout or error
    >> heavily.
    >> By using a list for saving the elements and converting them to an array
    >> afterwards, this problem is solved, and stdout-heavy surefire tests get
    >> faster.
    >> ------------------------------
    >> You can view, comment on, or merge this pull request online at:
    >>
    >>   https://github.com/apache/maven-surefire/pull/167
    >> Commit Summary
    >>
    >>    - Before, surefire created a new byte array with size of the input *3
    >>    for saving the unescaped input. This made
    >>
    >> File Changes
    >>
    >>    - *M* surefire-api/src/main/java/org/apache/maven/surefire/booter/
    >>    ForkingRunListener.java
    >>    <https://github.com/apache/maven-surefire/pull/167/files#diff-0>
    >>    (278)
    >>    - *M* surefire-api/src/main/java/org/apache/maven/surefire/util/
    >>    internal/StringUtils.java
    >>    <https://github.com/apache/maven-surefire/pull/167/files#diff-1>
    >>    (327)
    >>    - *M* surefire-api/src/test/java/org/apache/maven/surefire/util/
    >>    internal/StringUtilsTest.java
    >>    <https://github.com/apache/maven-surefire/pull/167/files#diff-2> (84)
    >>
    >> Patch Links:
    >>
    >>    - https://github.com/apache/maven-surefire/pull/167.patch
    >>    - https://github.com/apache/maven-surefire/pull/167.diff
    >>
    >> —
    >> You are receiving this because you are subscribed to this thread.
    >> Reply to this email directly, view it on GitHub
    >> <https://github.com/apache/maven-surefire/pull/167>, or mute the thread
    >> <https://github.com/notifications/unsubscribe-auth/AA_yR0DXigfKgA6fHyskr2on3rlGN3Jjks5srOREgaJpZM4P1tru>
    >> .
    >>
    >
    >
    >
    > --
    > Cheers
    > Tibor
    >
    
    
    
    -- 
    Cheers
    Tibor



---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire pull request #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on a diff in the pull request:

    https://github.com/apache/maven-surefire/pull/167#discussion_r154174674
  
    --- Diff: surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java ---
    @@ -200,14 +200,8 @@ void sendProps()
         @Override
         public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
         {
    -        byte[] header = stdout ? stdOutHeader : stdErrHeader;
    -        byte[] content =
    -            new byte[buf.length * 3 + 1]; // Hex-escaping can be up to 3 times length of a regular byte.
    -        int i = escapeBytesToPrintable( content, 0, buf, off, len );
    -        content[i++] = (byte) '\n';
    -        byte[] encodeBytes = new byte[header.length + i];
    -        System.arraycopy( header, 0, encodeBytes, 0, header.length );
    -        System.arraycopy( content, 0, encodeBytes, header.length, i );
    +        final byte[] header = stdout ? stdOutHeader : stdErrHeader;
    +        final byte[] encodeBytes = escapeBytesToPrintable( header, buf, off, len );
    --- End diff --
    
    Why it is so complex. Why you did not write the stream to `PrintStream#write(byte buf[], int off, int len)` and why you did not change `escapeBytesToPrintable` so that `header`, 'buf' would go to the method parameters and just only one array could be allocated without any copy-paste bytes?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    You completely changed code style.
    Please use ASF Maven code style because here I do not see relevant changes.
    
    On Wed, Oct 11, 2017 at 5:52 PM, DaGeRe <no...@github.com> wrote:
    
    > Currently, surefire creates a new byte array with size of the input *3 for
    > saving the unescaped input. This made surefire way slower than running a
    > test directly in eclipse or with gradle, if it used standardout or error
    > heavily.
    > By using a list for saving the elements and converting them to an array
    > afterwards, this problem is solved, and stdout-heavy surefire tests get
    > faster.
    > ------------------------------
    > You can view, comment on, or merge this pull request online at:
    >
    >   https://github.com/apache/maven-surefire/pull/167
    > Commit Summary
    >
    >    - Before, surefire created a new byte array with size of the input *3
    >    for saving the unescaped input. This made
    >
    > File Changes
    >
    >    - *M* surefire-api/src/main/java/org/apache/maven/surefire/
    >    booter/ForkingRunListener.java
    >    <https://github.com/apache/maven-surefire/pull/167/files#diff-0> (278)
    >    - *M* surefire-api/src/main/java/org/apache/maven/surefire/
    >    util/internal/StringUtils.java
    >    <https://github.com/apache/maven-surefire/pull/167/files#diff-1> (327)
    >    - *M* surefire-api/src/test/java/org/apache/maven/surefire/
    >    util/internal/StringUtilsTest.java
    >    <https://github.com/apache/maven-surefire/pull/167/files#diff-2> (84)
    >
    > Patch Links:
    >
    >    - https://github.com/apache/maven-surefire/pull/167.patch
    >    - https://github.com/apache/maven-surefire/pull/167.diff
    >
    > —
    > You are receiving this because you are subscribed to this thread.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/maven-surefire/pull/167>, or mute the thread
    > <https://github.com/notifications/unsubscribe-auth/AA_yR0DXigfKgA6fHyskr2on3rlGN3Jjks5srOREgaJpZM4P1tru>
    > .
    >
    
    
    
    -- 
    Cheers
    Tibor



---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    @DaGeRe 
    Yes we need to add your Jira issue to a final report which is part or final plugin release.
    Only you best know all details to be written in description in Jira, platform you have used, found buggy version, other references, a link to GitHub PR, etc.
    Here is the link https://issues.apache.org/jira/projects/SUREFIRE


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    @DaGeRe 
    Close this PR on GitHub. I have made a fix.
    See this Jira issue: https://issues.apache.org/jira/browse/SUREFIRE-1454


---

[GitHub] maven-surefire issue #167: Speedup Standard Output if Tests

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/167
  
    @DaGeRe 
    Did you create a ticket in JIRA?
    https://issues.apache.org/jira/browse/SUREFIRE
    If you did, which ticket number it is?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire pull request #167: Speedup Standard Output if Tests

Posted by DaGeRe <gi...@git.apache.org>.
Github user DaGeRe commented on a diff in the pull request:

    https://github.com/apache/maven-surefire/pull/167#discussion_r154208805
  
    --- Diff: surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java ---
    @@ -200,14 +200,8 @@ void sendProps()
         @Override
         public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
         {
    -        byte[] header = stdout ? stdOutHeader : stdErrHeader;
    -        byte[] content =
    -            new byte[buf.length * 3 + 1]; // Hex-escaping can be up to 3 times length of a regular byte.
    -        int i = escapeBytesToPrintable( content, 0, buf, off, len );
    -        content[i++] = (byte) '\n';
    -        byte[] encodeBytes = new byte[header.length + i];
    -        System.arraycopy( header, 0, encodeBytes, 0, header.length );
    -        System.arraycopy( content, 0, encodeBytes, header.length, i );
    +        final byte[] header = stdout ? stdOutHeader : stdErrHeader;
    +        final byte[] encodeBytes = escapeBytesToPrintable( header, buf, off, len );
    --- End diff --
    
    In my experiments, many calls of PrintStream#write lead to a heavily decreased performance compared to sending bigger arrays to the PrintStream. Therefore, I constructed a big array every time, and this needed differend handling.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org