Opened 8 days ago

Closed 8 days ago

Last modified 7 days 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

Description

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

Attachments (1)

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

Download all attachments as: .zip

Change History (5)

Changed 8 days ago by Дилян Палаузов

Attachment: less_ifs.patch added

comment:1 Changed 8 days 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 8 days 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 8 days ago by GitHub <noreply@…>

Resolution: fixed
Status: newclosed

In 02d9419f:

Fixed #28907 -- Removed unnecessary if statements.

comment:4 Changed 7 days 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