Commit cb1ba5b
authored
core: remove extra allocation in MessageFramer
OutputStreamAdapter is a private class, and is only ever called by two
places: ByteStreams.copy, which never calls the single byte method, and
DrainTo, which potentially can. There are two classes that implement
DrainTo, which is primarily ProtoInputStream. It calls
MessageLite.writeTo(OutputStream) or back again to ByteStreams.copy.
MessageLite.writeTo in turn wraps the OutputStream in a
CodedOutputStream.OutputStreamEncoder, which then never calls the single
byte version. Thus, all know implementations never call the single
byte override.
Additionally, it is well known that the single byte write is slow, and
is expected to be wrapped in a BufferedOutputStream if there are many
small writes.1 parent 1d5fd1f commit cb1ba5b
1 file changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
324 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
325 | 328 | | |
326 | 329 | | |
327 | | - | |
| 330 | + | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| |||
344 | 347 | | |
345 | 348 | | |
346 | 349 | | |
347 | | - | |
| 350 | + | |
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
| |||
0 commit comments