Skip to content

Answer the project-files FIXME with a measurement - #2143

Merged
bbatsov merged 1 commit into
masterfrom
docs/measure-project-files-fixme
Jul 29, 2026
Merged

Answer the project-files FIXME with a measurement#2143
bbatsov merged 1 commit into
masterfrom
docs/measure-project-files-fixme

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 29, 2026

Copy link
Copy Markdown
Owner

The project.el integration's project-files carried a FIXME guessing that
prepending the root to every path "is probably going to be very slow in large
projects". Nobody had checked.

Measured:

   1000 files: mapcar+concat    0.1 ms   | expand-file-name     1.6 ms
  10000 files: mapcar+concat    0.9 ms   | expand-file-name    18.0 ms
  50000 files: mapcar+concat    4.3 ms   | expand-file-name    79.9 ms
 200000 files: mapcar+concat   19.8 ms   | expand-file-name   319.9 ms

20 ms on a 200k-file project, next to nothing beside the listing it is
prepending to - and concat is already the fast choice here, 18 times quicker
than the expand-file-name someone might reach for, since that consults the
filesystem's notion of the default directory for paths that are already absolute.

No code change; the comment now records the numbers so the question stays
answered rather than being re-asked by the next reader.

The comment guessed that prepending the root to every path would be
very slow in large projects. It isn't: 4 ms for 50k files, 20 ms for
200k - next to nothing beside the listing it is prepending to, and
18 times faster than the expand-file-name it would otherwise take.

Recording the numbers so the question stays answered.
@bbatsov
bbatsov merged commit 2600359 into master Jul 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant