Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#28907 closed Cleanup/optimization (fixed)

Exploit that iterating over empty sequences is noop

Reported by: Дилян Палаузов Owned by: nobody
Component: Core (Other) Version: master
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


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

Attachments (1)

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

Download all attachments as: .zip

Change History (5)

Changed 20 months ago by Дилян Палаузов

Attachment: less_ifs.patch added

comment:1 Changed 20 months ago by Jaap Roes

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 Changed 20 months ago by Tim Graham

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 Changed 20 months ago by GitHub <noreply@…>

Resolution: fixed
Status: newclosed

In 02d9419f:

Fixed #28907 -- Removed unnecessary if statements.

comment:4 Changed 20 months ago by Дилян Палаузов

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