dart-lang/path

Don't dynamically update the current working directory by default

Opened this issue · 0 comments

nex3 commented

Currently in the default context, operations that need to know the current working directory (current, relative(), isWithin(), absolute(), and prettyUri()) have to check the working directory every time they run. This involves a call to Uri.base, which is reasonably expensive on the command-line VM and puts a severe limit on how much these functions can be optimized.

On the other hand, it's not clear how much value this behavior adds. It's rare for an application to switch its working directory, and if it does all its existing in-memory relative paths will become invalid anyway. When we decide to put out a breaking release, we should make the default context cache the first known value of current. We can then provide a dynamic context that has the current dynamic-updating behavior for users who need it.