Skip to content

Commit 6f585a2

Browse files
committed
update to latest
add ruby-vips8 as well
1 parent 4564e78 commit 6f585a2

File tree

8 files changed

+74
-46
lines changed

8 files changed

+74
-46
lines changed

Gemfile

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
source "http://rubygems.org"
2-
# Add dependencies required to use your gem here.
3-
# Example:
4-
# gem "activesupport", ">= 2.3.5"
52

63
# Add dependencies to develop your gem here.
74
# Include everything needed to run rake, tests, features, etc.

Gemfile.lock

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
GEM
22
remote: http://rubygems.org/
33
specs:
4-
RubyInline (3.12.3)
4+
RubyInline (3.12.4)
55
ZenTest (~> 4.3)
6-
ZenTest (4.10.0)
7-
addressable (2.3.6)
6+
ZenTest (4.11.0)
7+
addressable (2.4.0)
88
builder (3.2.2)
9-
faraday (0.8.9)
9+
faraday (0.8.11)
1010
multipart-post (~> 1.2.0)
11-
ffi (1.9.3)
12-
free-image (0.6.2)
11+
ffi (1.9.10)
12+
free-image (0.7.1)
1313
ffi (>= 1.0.10)
14-
git (1.2.6)
14+
git (1.2.9.1)
1515
github_api (0.10.1)
1616
addressable
1717
faraday (~> 0.8.1)
1818
hashie (>= 1.2)
1919
multi_json (~> 1.4)
2020
nokogiri (~> 1.5.2)
2121
oauth2
22-
hashie (3.0.0)
23-
highline (1.6.21)
22+
hashie (3.4.3)
23+
highline (1.7.8)
2424
image_science (1.2.6)
2525
RubyInline (~> 3.9)
2626
jeweler (1.8.8)
@@ -32,24 +32,24 @@ GEM
3232
nokogiri (= 1.5.10)
3333
rake
3434
rdoc
35-
json (1.8.1)
36-
jwt (1.0.0)
37-
multi_json (1.10.1)
35+
json (1.8.3)
36+
jwt (1.5.2)
37+
multi_json (1.11.2)
3838
multi_xml (0.5.5)
3939
multipart-post (1.2.0)
4040
nokogiri (1.5.10)
41-
oauth2 (0.9.4)
41+
oauth2 (1.0.0)
4242
faraday (>= 0.8, < 0.10)
4343
jwt (~> 1.0)
4444
multi_json (~> 1.3)
4545
multi_xml (~> 0.5)
4646
rack (~> 1.2)
47-
rack (1.5.2)
48-
rake (10.3.2)
49-
rdoc (4.1.1)
47+
rack (1.6.4)
48+
rake (10.5.0)
49+
rdoc (4.2.1)
5050
json (~> 1.4)
51-
rmagick (2.13.2)
52-
ruby-vips (0.3.8)
51+
rmagick (2.15.4)
52+
ruby-vips (0.3.13)
5353

5454
PLATFORMS
5555
ruby
@@ -61,3 +61,6 @@ DEPENDENCIES
6161
jeweler (~> 1.8.3)
6262
rmagick
6363
ruby-vips
64+
65+
BUNDLED WITH
66+
1.10.6

README.md

+19-16
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,45 @@ Last update: June 6, 2014.
99
## Benchmarks
1010

1111
```bash
12-
$ bundle exec ./runner
13-
Darwin 41.88.168.192.in-addr.arpa 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64
14-
15-
Ruby-vips 0.3.8 built against vips-7.38.5-Fri Jun 6 13:56:58 MSK 2014
16-
17-
Version: ImageMagick 6.8.8-9 Q16 x86_64 2014-06-06 http://www.imagemagick.org
12+
$ ./runner
13+
Linux kiwi 4.2.0-23-generic #28-Ubuntu SMP Sun Dec 27 17:47:31 UTC 2015 x86_64
14+
x86_64 x86_64 GNU/Linux
15+
Ruby-vips 0.3.13 built against vips-8.2.2-Fri Jan 22 16:28:35 GMT 2016
16+
Version: ImageMagick 6.8.9-9 Q16 x86_64 2015-08-06 http://www.imagemagick.org
1817
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
19-
Features: DPC Modules
20-
Delegates: bzlib fftw freetype jng jpeg lcms ltdl png tiff xml zlib
18+
Features: DPC Modules OpenMP
19+
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl
20+
lzma openexr pangocairo png tiff wmf x xml zlib
2121

2222
Image Science 1.2.6
23-
2423
building test image ...
2524
tile=10
2625
test image is 2900 by 4420 pixels
2726
making tiff and jpeg derivatives ...
2827
timing ruby/ruby-vips.rb ... done
28+
timing ruby/ruby-vips8.rb ... done
2929
timing ruby/rmagick.rb ... done
3030
timing image-magick/image-magick ... done
3131
timing ruby/image_sci.rb ... done
3232
measuring memuse for ruby/ruby-vips.rb ... done
33+
measuring memuse for ruby/ruby-vips8.rb ... done
3334
measuring memuse for ruby/rmagick.rb ... done
3435
measuring memuse for ruby/image_sci.rb ... done
3536

3637
real time in seconds, fastest of three runs
3738
benchmark tiff jpeg
38-
ruby-vips.rb 1.42 1.62
39-
image_sci.rb 1.47 1.70
40-
rmagick.rb 1.63 1.87
41-
image-magick 1.68 2.01
39+
ruby-vips.rb 0.25 0.33
40+
ruby-vips8.rb 0.45 0.52
41+
image-magick 0.86 1.03
42+
rmagick.rb 0.92 1.01
43+
image_sci.rb 1.11 0.88
4244

4345
peak memory use in bytes
4446
benchmark peak RSS
45-
ruby-vips.rb 184926208
46-
image_sci.rb 629784576
47-
rmagick.rb 1465909248
47+
ruby-vips.rb 52828
48+
ruby-vips8.rb 60464
49+
image_sci.rb 146228
50+
rmagick.rb 350136
4851
```
4952

5053
## Performance test design

image-magick/image-magick

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# we can't crop 100 pixels with the crop-on-load syntax, so we have to
55
# find the width and height ourselves
66

7-
width=`header -f Xsize $1`
8-
height=`header -f Ysize $1`
7+
width=$(vipsheader -f Xsize $1)
8+
height=$(vipsheader -f Ysize $1)
99

1010
width=$((width - 200))
1111
height=$((height - 200))

ruby/rmagick.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22

33
require 'rubygems'
4-
require 'RMagick'
4+
require 'rmagick'
55

66
include Magick
77

ruby/ruby-vips8.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'vips8'
4+
5+
im = Vips::Image.new_from_file ARGV[0], :access => :sequential
6+
7+
im = im.crop 100, 100, im.width - 200, im.height - 200
8+
im = im.similarity :scale => 0.9
9+
mask = Vips::Image.new_from_array [
10+
[-1, -1, -1],
11+
[-1, 16, -1],
12+
[-1, -1, -1]], 8
13+
im = im.conv(mask)
14+
15+
im.write_to_file ARGV[1]

ruby/versions/ruby-vips8.rb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'rubygems'
4+
require 'vips'
5+
6+
LIBVIPS_VERSION = %x[vips --version]
7+
8+
puts "Ruby-vips #{VIPS::VERSION} built against #{LIBVIPS_VERSION}"

runner

+8-6
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ sample=images/sample2.v
2121

2222
echo building test image ...
2323
echo "tile=$tile"
24-
vips im_replicate $sample $tmp/t.v $tile $tile
24+
vips replicate $sample $tmp/t.v $tile $tile
2525
if [ $? != 0 ]; then
2626
echo "build of test image failed -- out of disc space?"
2727
exit 1
2828
fi
29-
echo -n "test image is" `header -f width $tmp/t.v`
30-
echo " by" `header -f height $tmp/t.v` "pixels"
29+
echo -n "test image is" $(vipsheader -f width $tmp/t.v)
30+
echo " by" $(vipsheader -f height $tmp/t.v) "pixels"
3131

3232
echo making tiff and jpeg derivatives ...
33-
vips im_copy $tmp/t.v $tmp/t.tif
34-
vips im_copy $tmp/t.v $tmp/t.jpg
33+
vips copy $tmp/t.v $tmp/t.tif
34+
vips copy $tmp/t.v $tmp/t.jpg
3535

3636
# we want to use the time program, not the one built into the shell
37-
time=/usr/local/bin/time
37+
time=$(which time)
3838
if [ $? != 0 ]; then
3939
echo "unable to locate 'time' program"
4040
exit 1
@@ -80,6 +80,7 @@ function benchmark() {
8080
# tests we run
8181
programs="\
8282
ruby/ruby-vips.rb \
83+
ruby/ruby-vips8.rb \
8384
ruby/rmagick.rb \
8485
image-magick/image-magick \
8586
ruby/image_sci.rb
@@ -97,6 +98,7 @@ done
9798
# subprocesses
9899
programs="\
99100
ruby/ruby-vips.rb \
101+
ruby/ruby-vips8.rb \
100102
ruby/rmagick.rb \
101103
ruby/image_sci.rb \
102104
"

0 commit comments

Comments
 (0)