[ruby-core:125441] [Ruby Feature#22060] Improve Pathname by migrating internal methods to pathname.c
Issue #22060 has been reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Feature #22060: Improve Pathname by migrating internal methods to pathname.c https://bugs.ruby-lang.org/issues/22060 * Author: nobu (Nobuyoshi Nakada) * Status: Open ---------------------------------------- Currently, Pathname implementation is mainly in pathname_builtin.rb and only a few methods in pathname.c. The code in pathname_builtin.rb is using `File` methods probably for platform portabilities. This is kind of smart but is a roundabout way and is hard to understand. I think it can be easier to maintain and more efficient by migrating some internal methods to pathname.c. Comparison with master 9fefb48643: | |master w/o JIT|PR w/o JIT|master w/ JIT|PR w/ JIT| |:-------------------|-------------:|---------:|------------:|--------:| |p1+p2 | 332.541k| 696.202k| 347.315k| 952.254k| | | -| 2.09x| 1.04x| 2.86x| |abs.root? | 3.282M| 97.180M| 3.504M| 82.821M| | | -| 29.61x| 1.07x| 25.23x| |rel.root? | 3.298M| 101.917M| 3.535M| 96.676M| | | -| 30.91x| 1.07x| 29.32x| |abs.absolute? | 22.184M| 110.749M| 31.099M| 129.464M| | | -| 4.99x| 1.40x| 5.84x| |rel.absolute? | 30.862M| 111.914M| 47.010M| 118.712M| | | -| 3.63x| 1.52x| 3.85x| |p1.cleanpath | 395.604k| 904.909k| 418.752k| 1.342M| | | -| 2.29x| 1.06x| 3.39x| |p2.cleanpath | 445.949k| 982.354k| 468.972k| 1.451M| | | -| 2.20x| 1.05x| 3.25x| |relative_path_from | 137.595k| 271.209k| 144.976k| 393.710k| | | -| 1.97x| 1.05x| 2.86x| Although YJIT is not effective on `Pathname#root?`, probably it is too simple for JIT. [GH-16907](https://github.com/ruby/ruby/pull/16907) -- https://bugs.ruby-lang.org/
Issue #22060 has been updated by nobu (Nobuyoshi Nakada). On Windows, `Pathname("a:.").absolute?` returns `true`, while `File.absolute_path?("a:.")` returns `false`. This path is typically a relative path based on the current directory on the drive, so I don't think it would be considered an absolute path. What is the reason for this behavior? ---------------------------------------- Feature #22060: Improve Pathname by migrating internal methods to pathname.c https://bugs.ruby-lang.org/issues/22060#change-117253 * Author: nobu (Nobuyoshi Nakada) * Status: Open ---------------------------------------- Currently, Pathname implementation is mainly in pathname_builtin.rb and only a few methods in pathname.c. The code in pathname_builtin.rb is using `File` methods probably for platform portabilities. This is kind of smart but is a roundabout way and is hard to understand. I think it can be easier to maintain and more efficient by migrating some internal methods to pathname.c. Comparison with master 9fefb48643: | |master w/o JIT|PR w/o JIT|master w/ JIT|PR w/ JIT| |:-------------------|-------------:|---------:|------------:|--------:| |p1+p2 | 332.541k| 696.202k| 347.315k| 952.254k| | | -| 2.09x| 1.04x| 2.86x| |abs.root? | 3.282M| 97.180M| 3.504M| 82.821M| | | -| 29.61x| 1.07x| 25.23x| |rel.root? | 3.298M| 101.917M| 3.535M| 96.676M| | | -| 30.91x| 1.07x| 29.32x| |abs.absolute? | 22.184M| 110.749M| 31.099M| 129.464M| | | -| 4.99x| 1.40x| 5.84x| |rel.absolute? | 30.862M| 111.914M| 47.010M| 118.712M| | | -| 3.63x| 1.52x| 3.85x| |p1.cleanpath | 395.604k| 904.909k| 418.752k| 1.342M| | | -| 2.29x| 1.06x| 3.39x| |p2.cleanpath | 445.949k| 982.354k| 468.972k| 1.451M| | | -| 2.20x| 1.05x| 3.25x| |relative_path_from | 137.595k| 271.209k| 144.976k| 393.710k| | | -| 1.97x| 1.05x| 2.86x| Although YJIT is not effective on `Pathname#root?`, probably it is too simple for JIT. [GH-16907](https://github.com/ruby/ruby/pull/16907) -- https://bugs.ruby-lang.org/
Issue #22060 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Closed Assignee set to nobu (Nobuyoshi Nakada) https://github.com/ruby/ruby/pull/16907 has been merged. ---------------------------------------- Feature #22060: Improve Pathname by migrating internal methods to pathname.c https://bugs.ruby-lang.org/issues/22060#change-117360 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Assignee: nobu (Nobuyoshi Nakada) ---------------------------------------- Currently, Pathname implementation is mainly in pathname_builtin.rb and only a few methods in pathname.c. The code in pathname_builtin.rb is using `File` methods probably for platform portabilities. This is kind of smart but is a roundabout way and is hard to understand. I think it can be easier to understand and more efficient by migrating some internal methods to pathname.c. Comparison with master 9fefb48643: | |master w/o JIT|PR w/o JIT|master w/ JIT|PR w/ JIT| |:-------------------|-------------:|---------:|------------:|--------:| |p1+p2 | 332.541k| 696.202k| 347.315k| 952.254k| | | -| 2.09x| 1.04x| 2.86x| |abs.root? | 3.282M| 97.180M| 3.504M| 82.821M| | | -| 29.61x| 1.07x| 25.23x| |rel.root? | 3.298M| 101.917M| 3.535M| 96.676M| | | -| 30.91x| 1.07x| 29.32x| |abs.absolute? | 22.184M| 110.749M| 31.099M| 129.464M| | | -| 4.99x| 1.40x| 5.84x| |rel.absolute? | 30.862M| 111.914M| 47.010M| 118.712M| | | -| 3.63x| 1.52x| 3.85x| |p1.cleanpath | 395.604k| 904.909k| 418.752k| 1.342M| | | -| 2.29x| 1.06x| 3.39x| |p2.cleanpath | 445.949k| 982.354k| 468.972k| 1.451M| | | -| 2.20x| 1.05x| 3.25x| |relative_path_from | 137.595k| 271.209k| 144.976k| 393.710k| | | -| 1.97x| 1.05x| 2.86x| Although YJIT is not effective on `Pathname#root?`, probably it is too simple for JIT. [GH-16907](https://github.com/ruby/ruby/pull/16907) -- https://bugs.ruby-lang.org/
participants (2)
-
hsbt (Hiroshi SHIBATA) -
nobu (Nobuyoshi Nakada)