Skip to content

Rest Framework Settings file Performs an O(n) operation on settings access that could be O(1) #3786

Closed
@CuriousG102

Description

@CuriousG102

Calling .keys() on a dictionary returns an iterable, so doing a membership test against that iterable is an O(n) operation. By not including a call to .keys(), the same effect will be attained in O(1) time.

https://github.com/tomchristie/django-rest-framework/blob/af0ea8ef5136da30cb058b10a493d36619d24add/rest_framework/settings.py#L199

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions