Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#28907 closed Cleanup/optimization (fixed)

Exploit that iterating over empty sequences is noop

Reported by: Дилян Палаузов Owned by: nobody
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

.. and don't check if a sequence is empty, before looping over it

Attachments (1)

less_ifs.patch (7.4 KB ) - added by Дилян Палаузов 6 years ago.

Download all attachments as: .zip

Change History (5)

by Дилян Палаузов, 6 years ago

Attachment: less_ifs.patch added

comment:1 by Jaap Roes, 6 years ago

This would be easier to review if it was a pull request.

In the patch I see at least one case where the if condition should not be eliminated because it also needs to catch None values.

comment:2 by Tim Graham, 6 years ago

Component: UncategorizedCore (Other)
Triage Stage: UnreviewedReady for checkin

PR. I removed the test changes from the patch as those don't work as Jaap mentioned.

comment:3 by GitHub <noreply@…>, 6 years ago

Resolution: fixed
Status: newclosed

In 02d9419f:

Fixed #28907 -- Removed unnecessary if statements.

comment:4 by Дилян Палаузов, 6 years ago

Indeed, I have not thought on the cases, where the if value: can be None.

Note: See TracTickets for help on using tickets.
Back to Top