diff --git a/README.adoc b/README.adoc index 6e8a54a..29a4c1e 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,6 @@ = Tebako benchmarking -Tebako (https://github.com/tamatebako/tebako) is an executable packager. -This repository contains scripts that are used for tebako benchmarking and benchmarking results which are available +This repository contains scripts that are used for https://github.com/tamatebako/tebako[tebako] benchmarking and benchmarking results which are available at results folder at https://github.com/tamatebako/tebako-benchmarking/blob/main/results/RESULTS.adoc -This is work area and does not not pretend to have a production quality or be reusable in any way. +This repository is a work area and does not not pretend to have a production quality or be reusable in any way. diff --git a/results/RESULTS.adoc b/results/RESULTS.adoc index b0b11ec..1e7f0cf 100644 --- a/results/RESULTS.adoc +++ b/results/RESULTS.adoc @@ -28,12 +28,10 @@ image::hello-world-benchmarking.jpg["Hello, world!" benchmarking results] A comparative analysis of the simpliest application shows that the Tebako package has a performance advantage over long runs. This is because the runtime library is served from an in-memory file system with significantly better access times. -In short runs, Tebako loses because the package includes many files and components that are not used by the application, but are still loaded into memory. -This creates a penalty of 0.3 seconds, which is however negligible in runs experiments. +In short runs, Tebako loses because the package includes many files and components that are not used by the application, but are loaded into memory anyway. +This creates a penalty of 0.3 seconds, which is however negligible in for larger application. -== coradoc gem - -https://rubygems.org/gems/coradoc +== https://rubygems.org/gems/coradoc[coradoc gem] ``` puts "Hello! This is coradoc benchmarking test." @@ -63,15 +61,11 @@ argv[0].to_i.times do Coradoc::Transformer.transform(syntax_tree) end ``` -With this test we compare intensive native Ruby code processing. Tebako package shows stable 20% performance gain. -This gain is a result of faster access to Ruby standard library as explained above. -Also the test shows that there is no difference in code execution between native Ruby and tebako package. +With this test we benchmark Ruby gem without native extensions, i.e.: intensive Ruby code processing. image::coradoc-benchmarking.jpg[coradoc benchmarking results] -== emf2svg gem - -https://rubygems.org/gems/emf2svg +== https://rubygems.org/gems/emf2svg[emf2svg gem] ``` require "tempfile" @@ -99,9 +93,44 @@ argv[0].to_i.times do end end ``` - +With this test we benchmark Ruby gem with reltively small native extensions. +The test shows that Tebako package takes extra time to setup native extension because it extracts extension as a file from memfs into temp folder and load back as a shared library. + image::emf2svg-benchmarking.jpg[emf2svg benchmarking results] +== https://rubygems.org/gems/vectory[vectory gem] + +``` +require "tempfile" + +puts "Hello! This is vectory benchmarking test." + +if (argv = ARGV).empty? + puts "No arguments given" + exit(1) +end + +if argv[0].to_i < 1 + puts "Argument must be a positive integer" + exit(1) +end + +argv[0].to_i.times do + require "vectory" + + svg = Vectory::Emf.from_path(File.join(__dir__, "fixtures", "img.emf")).to_svg.content + + Tempfile.create(["output", ".svg"]) do |tempfile| + tempfile.write(svg) + puts "SVG written to #{tempfile.path}" + end +end +``` +With this test we benchmark Ruby gem with reltively small native extensions. +The test shows that Tebako package takes extra time to setup native extension because it extracts extension as a file from memfs into temp folder and load back as a shared library. + +image::vectory-benchmarking.jpg[vectory benchmarking results] + == Execution environment ``` diff --git a/results/img/coradoc-benchmarking.jpg b/results/img/coradoc-benchmarking.jpg index 8fe1681..5f95458 100644 Binary files a/results/img/coradoc-benchmarking.jpg and b/results/img/coradoc-benchmarking.jpg differ diff --git a/results/img/emf2svg-benchmarking.jpg b/results/img/emf2svg-benchmarking.jpg index 37ef0a0..a89ba28 100644 Binary files a/results/img/emf2svg-benchmarking.jpg and b/results/img/emf2svg-benchmarking.jpg differ diff --git a/results/img/vectory-benchmarking.jpg b/results/img/vectory-benchmarking.jpg new file mode 100644 index 0000000..820afb3 Binary files /dev/null and b/results/img/vectory-benchmarking.jpg differ diff --git a/results/raw/results.xlsx b/results/raw/results.xlsx index dc55f82..1a58d3a 100644 Binary files a/results/raw/results.xlsx and b/results/raw/results.xlsx differ diff --git a/tebako-benchmarking.gemspec b/tebako-benchmarking.gemspec index 2cebebf..2bf6657 100644 --- a/tebako-benchmarking.gemspec +++ b/tebako-benchmarking.gemspec @@ -62,5 +62,6 @@ Gem::Specification.new do |spec| spec.add_dependency "tebako", "~> 0.5.5" spec.add_dependency "tebako-runtime", "~> 0.2.1" spec.add_dependency "thor", "~> 1.2" + spec.add_dependency "vectory", "~> 0.2.0" spec.add_dependency "yaml", "~> 0.2.1" end diff --git a/tests/vectory-test/Gemfile b/tests/vectory-test/Gemfile new file mode 100644 index 0000000..a59e2a8 --- /dev/null +++ b/tests/vectory-test/Gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "vectory", "~> 0.2.0" diff --git a/tests/vectory-test/fixtures/img.emf b/tests/vectory-test/fixtures/img.emf new file mode 100644 index 0000000..e93c33c Binary files /dev/null and b/tests/vectory-test/fixtures/img.emf differ diff --git a/tests/vectory-test/vectory-test-run.rb b/tests/vectory-test/vectory-test-run.rb new file mode 100755 index 0000000..357742b --- /dev/null +++ b/tests/vectory-test/vectory-test-run.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require "tempfile" + +puts "Hello! This is vectory benchmarking test." + +if (argv = ARGV).empty? + puts "No arguments given" + exit(1) +end + +if argv[0].to_i < 1 + puts "Argument must be a positive integer" + exit(1) +end + +argv[0].to_i.times do + require "vectory" + + svg = Vectory::Emf.from_path(File.join(__dir__, "fixtures", "img.emf")).to_svg.content + + Tempfile.create(["output", ".svg"]) do |tempfile| + tempfile.write(svg) + puts "SVG written to #{tempfile.path}" + end +end