Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase out get_dataset_root() #626

Closed
mih opened this issue Feb 6, 2024 · 1 comment
Closed

Phase out get_dataset_root() #626

mih opened this issue Feb 6, 2024 · 1 comment
Milestone

Comments

@mih
Copy link
Member

mih commented Feb 6, 2024

Right now this is only used in the tree command. It uses the datalad-core implementation that has a complex behavior (involving normpathing). At the same time, this is little more than

git rev-parse --show-toplevel

@mih mih added this to the 2.0 milestone Feb 6, 2024
@mih
Copy link
Member Author

mih commented Feb 7, 2024

Like with #631 the rev-parse approach is too slow to justify the reduction in code complexity

Getting the equivalent of ../../../..:

>>> %timeit get_dataset_root('.')
19 µs ± 40.1 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)

>>> %timeit call_git_oneline(['rev-parse', '--show-toplevel'])
2.26 ms ± 9.78 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

@mih mih closed this as completed Feb 7, 2024
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

No branches or pull requests

1 participant