bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib-tool.py: Update TODO file


From: Bruno Haible
Subject: Re: gnulib-tool.py: Update TODO file
Date: Sun, 24 Mar 2024 01:01:16 +0100

Hi Collin,

> Since one bullet point is inlining 'sed' invocations, it might also be
> worth considering doing the same for 'find'.

Two considerations:

* Is os.walk() as efficient as the 'find' command? On some file systems,
  determining the type (file vs. directory) of a directory entry requires
  an extra stat() call; on others, it is no extra overhead. We can assume
  that the 'find' command is well optimized.
  The os.walk documentation says: "Changed in version 3.5: This function
  now calls os.scandir() instead of os.listdir(), making it faster by
  reducing the number of calls to os.stat()."
  Does it mean that os.walk is as fully optimized as the 'find' command?
  I can't tell without looking into the Python sources or making actual
  measurements.

* There is only 1 'find' invocation per gnulib-tool invocation. It does
  not occur in a loop. Therefore it is not necessarily worth optimizing.

  Whereas the 'sed' invocation in GLFileSystem.py:382 is run in a loop.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]