abacef commented on code in PR #7819:
URL: https://github.com/apache/arrow-rs/pull/7819#discussion_r2183827698


##########
arrow-json/src/reader/string_array.rs:
##########
@@ -103,20 +109,20 @@ impl<O: OffsetSizeTrait> ArrayDecoder for 
StringArrayDecoder<O> {
                 TapeElement::I64(high) if coerce_primitive => match tape.get(p 
+ 1) {
                     TapeElement::I32(low) => {
                         let val = ((high as i64) << 32) | (low as u32) as i64;
-                        builder.append_value(val.to_string());
+                        builder.append_value(int_formatter.format(val));

Review Comment:
   Ok so I tested simply adding `write!` instead of `to_string`:
   
   ```rust
   write!(builder, "{n}").unwrap();
   builder.append_value("");
   ```
   vs
   ```rust
   builder.append_value(n.to_string());
   ```
   
   And the benches I wrote were 25% faster, so slower than itoa and ryu, but 
for some reason the previously written benches were all regressing by 15%:
   
   ```
   bench_integer           time:   [6.6288 ms 6.6426 ms 6.6605 ms]
                           change: [+16.009% +16.295% +16.619%] (p = 0.00 < 
0.05)
                           Performance has regressed. 
   ```
   
   So at least that is a positive for using these libraries.
   
   For ryu writing directly to the buffer, I was not able to find a way to do 
this since it seems like their internal buffer is coupled to the write 
implementation 😢 



-- 
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]

Reply via email to