Skip to content

Transfer of execution data through socket should use buffered stream#2089

Merged
Godin merged 9 commits into
jacoco:masterfrom
Godin:BufferedSocket
Jun 4, 2026
Merged

Transfer of execution data through socket should use buffered stream#2089
Godin merged 9 commits into
jacoco:masterfrom
Godin:BufferedSocket

Conversation

@Godin

@Godin Godin commented Mar 26, 2026

Copy link
Copy Markdown
Member

While working on #2073 I noticed that

  • socket.getOutputStream() is not wrapped into BufferedOutputStream when writing execution data
  • socket.getInputStream() is not wrapped into BufferedInputStream when reading execution data

Seems that this always been like that since version 0.4.0 that 16 years ago introduced remote dumps via TCP/IP connections.

Corresponding change for EclEmma - eclipse-eclemma/eclemma#130


For the record here is results from my machine of benchmark added in this PR when executed on JDK 25:

Benchmark                                    (benchmarkSide)  (bufferedReceiver)  (bufferedSender)  (dataSize)     (dataType)  Mode  Cnt   Score   Error  Units
CompactDataThroughSocketBenchmark.benchmark           SENDER                true              true          32         STRING  avgt   10   0.052 ± 0.003  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true              true         128         STRING  avgt   10   0.147 ± 0.013  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true              true        1024         STRING  avgt   10   1.286 ± 0.101  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true              true          32  BOOLEAN_ARRAY  avgt   10   0.031 ± 0.001  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true              true         128  BOOLEAN_ARRAY  avgt   10   0.119 ± 0.004  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true              true        1024  BOOLEAN_ARRAY  avgt   10   0.845 ± 0.041  us/op

CompactDataThroughSocketBenchmark.benchmark           SENDER                true             false          32         STRING  avgt   10   0.729 ± 0.009  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true             false         128         STRING  avgt   10   0.943 ± 0.048  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true             false        1024         STRING  avgt   10   1.713 ± 0.025  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true             false          32  BOOLEAN_ARRAY  avgt   10   3.275 ± 0.045  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true             false         128  BOOLEAN_ARRAY  avgt   10  11.783 ± 0.212  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER                true             false        1024  BOOLEAN_ARRAY  avgt   10  85.378 ± 1.166  us/op

CompactDataThroughSocketBenchmark.benchmark           SENDER               false              true          32         STRING  avgt   10   0.703 ± 0.010  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false              true         128         STRING  avgt   10   0.843 ± 0.011  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false              true        1024         STRING  avgt   10   1.863 ± 0.011  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false              true          32  BOOLEAN_ARRAY  avgt   10   1.496 ± 0.022  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false              true         128  BOOLEAN_ARRAY  avgt   10   5.231 ± 0.107  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false              true        1024  BOOLEAN_ARRAY  avgt   10  38.525 ± 0.655  us/op

CompactDataThroughSocketBenchmark.benchmark           SENDER               false             false          32         STRING  avgt   10   0.891 ± 0.042  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false             false         128         STRING  avgt   10   1.077 ± 0.073  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false             false        1024         STRING  avgt   10   1.672 ± 0.074  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false             false          32  BOOLEAN_ARRAY  avgt   10   3.434 ± 0.039  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false             false         128  BOOLEAN_ARRAY  avgt   10  11.991 ± 0.210  us/op
CompactDataThroughSocketBenchmark.benchmark           SENDER               false             false        1024  BOOLEAN_ARRAY  avgt   10  91.538 ± 7.731  us/op

CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true              true          32         STRING  avgt   10   0.054 ± 0.002  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true              true         128         STRING  avgt   10   0.143 ± 0.002  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true              true        1024         STRING  avgt   10   1.285 ± 0.222  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true              true          32  BOOLEAN_ARRAY  avgt   10   0.029 ± 0.002  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true              true         128  BOOLEAN_ARRAY  avgt   10   0.115 ± 0.006  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true              true        1024  BOOLEAN_ARRAY  avgt   10   0.825 ± 0.022  us/op

CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true             false          32         STRING  avgt   10   0.738 ± 0.023  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true             false         128         STRING  avgt   10   0.882 ± 0.029  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true             false        1024         STRING  avgt   10   1.698 ± 0.037  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true             false          32  BOOLEAN_ARRAY  avgt   10   3.181 ± 0.077  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true             false         128  BOOLEAN_ARRAY  avgt   10  11.605 ± 0.216  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER                true             false        1024  BOOLEAN_ARRAY  avgt   10  84.648 ± 1.607  us/op

CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false              true          32         STRING  avgt   10   0.697 ± 0.028  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false              true         128         STRING  avgt   10   0.810 ± 0.017  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false              true        1024         STRING  avgt   10   1.729 ± 0.109  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false              true          32  BOOLEAN_ARRAY  avgt   10   1.526 ± 0.055  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false              true         128  BOOLEAN_ARRAY  avgt   10   5.251 ± 0.229  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false              true        1024  BOOLEAN_ARRAY  avgt   10  37.466 ± 0.832  us/op

CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false             false          32         STRING  avgt   10   0.889 ± 0.038  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false             false         128         STRING  avgt   10   1.031 ± 0.067  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false             false        1024         STRING  avgt   10   1.768 ± 0.116  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false             false          32  BOOLEAN_ARRAY  avgt   10   3.281 ± 0.147  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false             false         128  BOOLEAN_ARRAY  avgt   10  12.009 ± 0.269  us/op
CompactDataThroughSocketBenchmark.benchmark         RECEIVER               false             false        1024  BOOLEAN_ARRAY  avgt   10  86.965 ± 3.639  us/op

  • apply suggestions from code review
  • update examples
  • update javadocs of RemoteControlWriter and RemoteControlReader constructors
  • update changelog

Comment thread org.jacoco.core/src/org/jacoco/core/tools/ExecDumpClient.java
Comment thread org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/output/TcpConnection.java Outdated
@Godin Godin force-pushed the BufferedSocket branch 4 times, most recently from 9b97e0b to 93919a9 Compare June 4, 2026 08:01
@Godin Godin marked this pull request as ready for review June 4, 2026 19:34
@Godin Godin enabled auto-merge (squash) June 4, 2026 19:35
@Godin Godin merged commit 5c05141 into jacoco:master Jun 4, 2026
31 checks passed
@Godin Godin deleted the BufferedSocket branch June 4, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants