zjregee commented on issue #14610:
URL: https://github.com/apache/datafusion/issues/14610#issuecomment-2653494265

   Hi, @alamb, I have a few questions and hope to get some help.
   
   Is the optimization mentioned here similar to using the following method 
instead?
   
   ```rust
   for _ in 0..number {
       write!(builder, "{}", string)?;
   }
   builder.append_value("")
   ```
   
   This seems to work well when the number of repetitions is small, because it 
reduces the number of memory copies, but when the number of repetitions is 
large, the repeated memory expansion will lead to performance degradation.
   
   The test results are as follows:
   ```text
   repeat 3 times/repeat_string_view [size=1024, repeat_times=3]
                           time:   [26.203 µs 26.286 µs 26.390 µs]
                           change: [-34.686% -34.382% -34.061%] (p = 0.00 < 
0.05)
                           Performance has improved.
   repeat 3 times/repeat_string [size=1024, repeat_times=3]
                           time:   [26.313 µs 27.236 µs 28.189 µs]
                           change: [-32.881% -30.398% -27.949%] (p = 0.00 < 
0.05)
                           Performance has improved.
   repeat 3 times/repeat_large_string [size=1024, repeat_times=3]
                           time:   [26.785 µs 26.876 µs 26.970 µs]
                           change: [-12.831% -11.753% -10.991%] (p = 0.00 < 
0.05)
                           Performance has improved.
   
   repeat 30 times/repeat_string_view [size=1024, repeat_times=30]
                           time:   [255.89 µs 257.33 µs 258.78 µs]
                           change: [+91.575% +103.40% +116.22%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   repeat 30 times/repeat_string [size=1024, repeat_times=30]
                           time:   [228.56 µs 235.81 µs 244.25 µs]
                           change: [+64.653% +71.663% +80.334%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   repeat 30 times/repeat_large_string [size=1024, repeat_times=30]
                           time:   [238.48 µs 245.03 µs 252.40 µs]
                           change: [+76.311% +86.412% +98.466%] (p = 0.00 < 
0.05)
                           Performance has regressed.
   ```


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to