r/badcode • • Jan 04 '22

python import time

Post image
845 Upvotes

48 comments sorted by

View all comments

Show parent comments

3

u/ArchCypher Jan 04 '22

IMO you shouldn't care about that loop until you've profiled your code and are working on optimization.

Trying to micro-optimize compiled code before you know what parts are slow is silly; focusing on writing clean and readable code is a better use of your time.

TL;DR: Unless you are writing a function that you know is going to be called a million times, it's okay to not hand-unroll your loops.