5 ms·
Not super familiar with Python but isn't that append call within a loop going to cause a lot of allocations?
by Tarq0n 4y ago
Not super familiar with Python but isn't that append call within a loop going to cause a lot of allocations?
- akasakahakada 4y ago3000 calls to list.append() cost only 2ms. In a computational intense program, no one bothers. Because usually one call to do matrix multiplication is already costing 500ms or so. Of couse you can prelocate memory for size=3000, and append stuff in a loop. But this saves only 10ms. Too insignificant.