iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🦔

Notes on Improving NumPy Performance

に公開

I would like to update this as needed.

When adding to an array is slow

np.append is slow

What to do?
→ If possible, use a standard list, append to it, and then convert it back to numpy at the end.
→ Furthermore, if possible, consider list comprehensions instead of for loops.

When concatenating arrays is slow

np.concatenate is slow

What to do?
→ If possible, use a standard list, extend it, and then convert it back to numpy at the end.

Discussion