13 votes

Python Performance: Why 'if not list' is 2x faster than using len()

1 comment

  1. teaearlgraycold
    Link
    Seems like something that could be optimized by detecting the pattern of opcodes and checking that the object is a list on first execution, patching in a check and list optimization for future...

    Seems like something that could be optimized by detecting the pattern of opcodes and checking that the object is a list on first execution, patching in a check and list optimization for future executions if so.

    1 vote