@@ -59,13 +59,6 @@ impl<T:Timestamp+Send> Progcaster<T> {
5959 changes. compact ( ) ;
6060 if !changes. is_empty ( ) {
6161
62- // This logging is relatively more expensive than other logging, as we
63- // have formatting and string allocations on the main path. We do have
64- // local type information about the timestamp, and we could log *that*
65- // explicitly, but the consumer would have to know what to look for and
66- // interpret appropriately. That's a big ask, so let's start with this,
67- // and as folks need more performant logging think about allowing users
68- // to select the more efficient variant.
6962 self . progress_logging . as_ref ( ) . map ( |l| {
7063
7164 // Pre-allocate enough space; we transfer ownership, so there is not
@@ -74,14 +67,13 @@ impl<T:Timestamp+Send> Progcaster<T> {
7467 let mut messages = Box :: new ( Vec :: with_capacity ( changes. len ( ) ) ) ;
7568 let mut internal = Box :: new ( Vec :: with_capacity ( changes. len ( ) ) ) ;
7669
77- // TODO: Reconsider `String` type or perhaps re-use allocation.
7870 for ( ( location, time) , diff) in changes. iter ( ) {
7971 match location. port {
8072 Port :: Target ( port) => {
81- messages. push ( ( location. node , port, format ! ( "{:?}" , time) , * diff) )
73+ messages. push ( ( location. node , port, time. clone ( ) , * diff) )
8274 } ,
8375 Port :: Source ( port) => {
84- internal. push ( ( location. node , port, format ! ( "{:?}" , time) , * diff) )
76+ internal. push ( ( location. node , port, time. clone ( ) , * diff) )
8577 }
8678 }
8779 }
@@ -144,15 +136,14 @@ impl<T:Timestamp+Send> Progcaster<T> {
144136 let mut messages = Vec :: with_capacity ( changes. len ( ) ) ;
145137 let mut internal = Vec :: with_capacity ( changes. len ( ) ) ;
146138
147- // TODO: Reconsider `String` type or perhaps re-use allocation.
148139 for ( ( location, time) , diff) in recv_changes. iter ( ) {
149140
150141 match location. port {
151142 Port :: Target ( port) => {
152- messages. push ( ( location. node , port, format ! ( "{:?}" , time) , * diff) )
143+ messages. push ( ( location. node , port, time. clone ( ) , * diff) )
153144 } ,
154145 Port :: Source ( port) => {
155- internal. push ( ( location. node , port, format ! ( "{:?}" , time) , * diff) )
146+ internal. push ( ( location. node , port, time. clone ( ) , * diff) )
156147 }
157148 }
158149 }
0 commit comments