Index: lib/src/context.dart |
diff --git a/lib/src/context.dart b/lib/src/context.dart |
index 44bdde994ea46daec0052052e8aaea4bc176be2e..a05ffda602947b31077172bba0e324d30949dee0 100644 |
--- a/lib/src/context.dart |
+++ b/lib/src/context.dart |
@@ -411,6 +411,9 @@ class Context { |
/// "/", no path can be determined. In this case, a [PathException] will be |
/// thrown. |
String relative(String path, {String from}) { |
+ // Avoid expensive computation if the path is already relative. |
+ if (from == null && this.isRelative(path)) return path; |
+ |
// Avoid calling [current] since it is slow and calling join() when |
// [from] is absolute does nothing. |
if (from == null) { |