I agree with this in general. In this particular case, though, it seems clear that the intention was to build a matrix block-by-block, where the advantage would be less, and also that it had to be pre-allocated.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Creating the same matrix in Julia as in Matlab takes longer time | 28 | 2351 | June 28, 2017 | |
| Array views becoming dominant source of memory allocation | 31 | 5383 | November 14, 2018 | |
| How do I use `@view` correctly? | 4 | 799 | June 23, 2020 | |
| Porting code from MatLab - performance tips | 18 | 556 | June 26, 2024 | |
| Parallel implementation is not very effective | 19 | 899 | October 8, 2022 |