mbeckerle commented on code in PR #1159:
URL: https://github.com/apache/daffodil/pull/1159#discussion_r1492689732
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JsonInfosetOutputter.scala:
##########
@@ -29,12 +29,15 @@ import org.apache.daffodil.runtime1.api.InfosetSimpleElement
import com.fasterxml.jackson.core.io.JsonStringEncoder
-class JsonInfosetOutputter private (writer: java.io.Writer, pretty: Boolean)
+class JsonInfosetOutputter private (writer: java.io.BufferedWriter, pretty:
Boolean)
extends InfosetOutputter
with Indentable {
def this(os: java.io.OutputStream, pretty: Boolean) = {
- this(new java.io.OutputStreamWriter(os, StandardCharsets.UTF_8), pretty)
+ this(
+ new java.io.BufferedWriter(new java.io.OutputStreamWriter(os,
StandardCharsets.UTF_8)),
Review Comment:
Add a comment here that this buffered writer provides significant
performance improvement.
My first thought was that you should only add a Buffered writer if os
argument is non-buffered, so you should conditionally check if the os output
stream is already buffered.
But we need a writer wrapped around the output stream anyway. And even if
the output stream is buffered, use of a buffered writer may still speed things
up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]