Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions benchmarks/hexapdf/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

require "hexapdf"
require "fileutils"
require "tmpdir"

IN_FILENAME = "odyssey.txt"
WIDTH = 50
HEIGHT = 1000

EXPECTED_SIZE = 569797

Dir["/tmp/hexapdf-result*.pdf"].each { |file| FileUtils.rm file }
OUT_DIR = Dir.tmpdir.freeze
Dir.glob("hexapdf-result*.pdf", base: OUT_DIR).each { |file| FileUtils.rm File.join(OUT_DIR, file) }

if ENV["RUBY_BENCH_RACTOR_HARNESS"]
make_shareable(HexaPDF::DefaultDocumentConfiguration)
Expand All @@ -36,7 +38,7 @@

# Non-TTF benchmark
iter += 1
out_filename = "/tmp/hexapdf-result-#{ "%03d" % iter }.pdf"
out_filename = File.join(OUT_DIR, "hexapdf-result-#{ "%03d" % iter }.pdf")


composer = HexaPDF::Composer.new(page_size: [0, 0, WIDTH, HEIGHT], margin: 0)
Expand All @@ -47,7 +49,8 @@
composer.write(out_filename, update_fields: false)
end

Dir["/tmp/hexapdf-result*.pdf"].each do |file|
Dir.glob("hexapdf-result*.pdf", base: OUT_DIR).each do |name|
file = File.join(OUT_DIR, name)
sz = File.stat(file).size
raise "Incorrect size #{sz} for file #{file} (expected #{EXPECTED_SIZE})!" unless sz == EXPECTED_SIZE
FileUtils.rm file
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/lee/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# we don't run "bundle install" above.

require_relative 'lib/lee'
require 'tmpdir'

#board_filename, output_filename, expansions_dir, *rest = ARGV
#raise 'no input filename' unless board_filename
#raise 'too many arguments' unless rest.empty?
board_filename = File.dirname(__FILE__) + "/inputs/testBoard.txt"
output_filename = "/tmp/testBoard.svg"
output_filename = File.join(Dir.tmpdir, "testBoard.svg")
expansions_dir = nil

if expansions_dir
Expand Down
Loading