Skip to content

Commit

Permalink
Make dir() about 15% faster
Browse files Browse the repository at this point in the history
- by providing more directed candidates
- had to disable signature check for dir() because it gave a false positive
  • Loading branch information
lizmat committed May 24, 2020
1 parent 1a8e07c commit 700b743
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/core.c/io_operators.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ multi sub prompt($msg) {
}

proto sub dir(|) {*}
multi sub dir(*%_) { $*SPEC.curdir.IO.dir(:!absolute, |%_) }
multi sub dir(IO::Path:D $path, |c) { $path.dir(|c) }
multi sub dir(IO() $path, |c) { $path.dir(|c) }
multi sub dir(IO() $path, :$test!) { $path.dir(:$test) }
multi sub dir(IO() $path ) { $path.dir }
multi sub dir(:$test!) { IO::Path.new($*SPEC.curdir).dir(:$test) }
multi sub dir( ) { IO::Path.new($*SPEC.curdir).dir }

proto sub open($, |) {*}
multi sub open(IO() $path, |c) { IO::Handle.new(:$path).open(|c) }
Expand Down
2 changes: 1 addition & 1 deletion t/02-rakudo/12-proto-arity-count.t
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ sub all-the-protos {
&deepmap,
&defined,
&die,
&dir,
# &dir,
&duckmap,
&elems,
&end,
Expand Down

0 comments on commit 700b743

Please sign in to comment.