Skip to content

Commit 17d949a

Browse files
committed
pathname: Add simple benchmarks
1 parent fe95156 commit 17d949a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

benchmark/pathname.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
prelude: |
2+
abs = Pathname("/a")
3+
rel = Pathname("a")
4+
p1 = Pathname.new('foo/././././bar')
5+
p2 = Pathname.new('foo/bar/./../..')
6+
p3 = Pathname.new('foo/bar/zot')
7+
class Pathname
8+
public :path, :chop_basename, :split_names
9+
end
10+
benchmark:
11+
p1.chop_basename: p1.chop_basename(p1.path)
12+
p1.split_names: p1.split_names(p1.path)
13+
p1+p2: p1+p2
14+
abs.root?: abs.root?
15+
rel.root?: rel.root?
16+
abs.absolute?: abs.absolute?
17+
rel.absolute?: rel.absolute?
18+
p1.cleanpath: p1.cleanpath
19+
p2.cleanpath: p2.cleanpath
20+
relative_path_from: p3.relative_path_from('foo/bar/qux/quax')

0 commit comments

Comments
 (0)