Skip to content

Conversation

@evadnoob
Copy link
Contributor

@evadnoob evadnoob commented Jun 25, 2025

use realpath, always available, instead of python

realpath in python

time python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" service.yaml
/Users/davidboon/Projects/outreach/devbase/evadnoob_fix_get-absolute-path-remove-python-dependency/service.yaml
python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" service.yaml  0.01s user 0.02s system 7% cpu 0.436 total

realpath from coreutils

time realpath service.yaml
/Users/davidboon/Projects/outreach/devbase/evadnoob_fix_get-absolute-path-remove-python-dependency/service.yaml
realpath service.yaml  0.00s user 0.00s system 15% cpu 0.013 total

the exec to python to noticibly slower than using realpath from
coreutils

use realpath, always available, instead of python

time python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" service.yaml
/Users/davidboon/Projects/outreach/devbase/evadnoob_fix_get-absolute-path-remove-python-dependency/service.yaml
python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" service.yaml  0.01s user 0.02s system 7% cpu 0.436 total

time realpath service.yaml
/Users/davidboon/Projects/outreach/devbase/evadnoob_fix_get-absolute-path-remove-python-dependency/service.yaml
realpath service.yaml  0.00s user 0.00s system 15% cpu 0.013 total

the exec to python to noticibly slower than using realpath from
coreutils
@evadnoob evadnoob requested a review from a team as a code owner June 25, 2025 17:26
Copy link
Member

@malept malept left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context:

Per Stack Exchange, realpath wasn't distributed with macOS until version 13, which probably wasn't supported by devbase when this implementation was written.

At a high level, this seems fine. However, a few things need to be resolved before this can be merged.

  • Linting failed in CI.
  • There's no reason for get_absolute_path to exist anymore, the one callsite can just call realpath directly.
  • This only changes scripts/devbase.sh, but this file is managed by Stencil (this module, in fact). So the changes need to also happen in templates/scripts/devbase.sh.tpl as well.

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.

2 participants