Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues when attempting to benchmark inline_svg #56

Open
tagliala opened this issue Nov 21, 2024 · 1 comment
Open

Issues when attempting to benchmark inline_svg #56

tagliala opened this issue Nov 21, 2024 · 1 comment

Comments

@tagliala
Copy link

tagliala commented Nov 21, 2024

Hi,

I suspect that there could be an issue in case the library has nested folders which alphabetically precede the library itself, but it is just a guess

re_namespaced_gems = [
  GemBench::Jersey.new(
    gem_name: "inline_svg",
    trades: {
      "InlineSvg" => 'InlineSvgGithubMain'
    },
    verbose: true
  ),
].each(&:doff_and_don) # Copies, re-namespaces, and requires each gem.
$ bundle exec ruby benchmarks.rb
[inline_svg] Doffing ~/.rvm/gems/ruby-3.3.6/bundler/gems/inline_svg-01b5e607814d
[inline_svg] --------------------------------
[inline_svg] Doffing file ~/.rvm/gems/ruby-3.3.6/bundler/gems/inline_svg-01b5e607814d/lib/inline_svg/action_view/helpers.rb
[inline_svg] --------------------------------
[inline_svg][helpers.rb] dirname: ~/.rvm/gems/ruby-3.3.6/bundler/gems/inline_svg-01b5e607814d/lib/inline_svg/action_view
[inline_svg][helpers.rb] is_at_gem_root: false
[inline_svg][helpers.rb] lib_split: inline_svg/action_view
[inline_svg][helpers.rb] relative_path: inline_svg/action_view
~/.rvm/gems/ruby-3.3.6/gems/gem_bench-2.0.5/lib/gem_bench/jersey.rb:95:in `mkdir': No such file or directory @ dir_s_mkdir - /var/folders/tmp/path/to/inline_svg/action_view (Errno::ENOENT)
	from ~/.rvm/gems/ruby-3.3.6/gems/gem_bench-2.0.5/lib/gem_bench/jersey.rb:95:in `block (2 levels) in doff_and_don'
	from ~/.rvm/gems/ruby-3.3.6/gems/gem_bench-2.0.5/lib/gem_bench/jersey.rb:72:in `map'
	from ~/.rvm/gems/ruby-3.3.6/gems/gem_bench-2.0.5/lib/gem_bench/jersey.rb:72:in `block in doff_and_don'
	from ~/.rvm/rubies/ruby-3.3.6/lib/ruby/3.3.0/tmpdir.rb:99:in `mktmpdir'
	from ~/.rvm/gems/ruby-3.3.6/gems/gem_bench-2.0.5/lib/gem_bench/jersey.rb:70:in `doff_and_don'

I've changed this line

Dir.mkdir(dir_path) unless Dir.exist?(dir_path)

with FileUtils.mkdir_p(dir_path) unless Dir.exist?(dir_path) (plus requiring fileutils) and it worked

PS: The gem does not work yet because of a couple of require relatives that I've missed: (jamesmartin/inline_svg#173)

PS2: Even with the changes at jamesmartin/inline_svg#173, gem_bench does not work with inline_svg

@pboling
Copy link
Owner

pboling commented Dec 2, 2024

Thanks for trying it out!! I will have a look and see if I can figure out where it fails. It struggles in certain scenarios where load order is important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants