Opened 4 years ago

Closed 3 years ago

#19523 closed Cleanup/optimization (fixed)

improve performance of django's bash completion

Reported by: rhertzog Owned by: nobody
Component: Core (Management commands) Version: 1.4
Severity: Normal Keywords:
Cc: andersk@…, luke@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In Anders Kaseorg <andersk@…> reported that the usage of the basename command was severly impacting the performances of Django's bash completion script.

The attached patch gets rid of "basename" in favor of some bash internal pattern substitution and improves the perfornance by a factor of 5 according to its author.

Attachments (1)

patch (1.4 KB) - added by rhertzog 4 years ago.
Patch to get rid of basename in Django's bash completion

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by rhertzog

Patch to get rid of basename in Django's bash completion

comment:1 Changed 4 years ago by lfaraone

  • Cc luke@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 4 years ago by aaugustin

  • Component changed from Uncategorized to Core (Management commands)

comment:4 Changed 3 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In e535da6865f0e02f0b593b52ed2e040b24a886d6:

Fixed #19523 -- Improved performance of Django's bash completion

Previous version took about 150ms to source, even on a warm cache,
primarily because it forks+execs /usr/bin/basename 44 times.
This patch makes it faster by a factor of 5 (and I imagine that a little
more thought would reduce the time to effectively zero).

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