Writing to a string builder first is slower and requires more memory. Unless there is a reason to cache, you should always directly write to the io.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Open, read and write binary into a file | 24 | 906 | December 22, 2021 | |
| Problem when writing json file | 7 | 360 | January 25, 2024 | |
| Why not defined Kernal#to_json use JSON.build(&) directly? | 6 | 307 | August 2, 2023 | |
| Performance issues with the JSON parser | 24 | 1147 | March 21, 2024 | |
| Jbuilder: an easy-to-use json builder in Crystal | 0 | 660 | October 24, 2020 |