zopfli-ffi 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +12 -2
- data/README.md +4 -1
- data/Rakefile +2 -0
- data/benchmark/benchmark.rb +24 -0
- data/ext/zopfli_ffi/Rakefile +2 -0
- data/lib/zopfli/version.rb +1 -1
- data/spec/travis_build.sh +1 -2
- data/spec/zopfli_ffi_spec.rb +4 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5299a7f6ea61d68c13b37d47734c5985109dbccf
|
4
|
+
data.tar.gz: ef614e49a3ff4c276bf500a91600c72318baf394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f664746ceb91d5c666a39be6261179a762fb1b8e52d8f7fd72de1284984c79e167f38e6735b2b2c66bcc2fab773b500cf958057eb8a340b83220580b4bcb756
|
7
|
+
data.tar.gz: b027dc2508710e8b7cc280d3a82b9474d6834ee09503db989604c4431d1afdaba03ee0ea437b75b79e326112d69d30a35a2157e5b8ffc5735a57e76d8f0aad64
|
data/.travis.yml
CHANGED
@@ -1,21 +1,31 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
before_install:
|
3
4
|
- ./spec/travis_build.sh > /dev/null 2>&1
|
5
|
+
- export LD_FLAGS=-L$HOME/opt/lib
|
6
|
+
- export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:$HOME/opt/lib
|
7
|
+
- export CPATH=$CPATH:$HOME/opt/include
|
8
|
+
|
4
9
|
rvm:
|
5
|
-
- 1.9.2
|
6
10
|
- 1.9.3
|
7
11
|
- 2.0.0
|
8
|
-
- 2.1.
|
12
|
+
- 2.1.5
|
9
13
|
- jruby-19mode
|
10
14
|
- rbx-19mode
|
11
15
|
- ruby-head
|
12
16
|
- jruby-head
|
17
|
+
|
18
|
+
cache: bundler
|
19
|
+
sudo: false
|
20
|
+
|
13
21
|
notifications:
|
14
22
|
email: false
|
23
|
+
|
15
24
|
branches:
|
16
25
|
only:
|
17
26
|
- master
|
18
27
|
- development
|
28
|
+
|
19
29
|
matrix:
|
20
30
|
allow_failures:
|
21
31
|
- rvm: rbx-19mode
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
# Zopfli-ffi
|
1
|
+
# Zopfli-ffi
|
2
|
+
|
3
|
+
[](https://travis-ci.org/le0pard/zopfli-ffi)
|
4
|
+
[](https://codeclimate.com/github/le0pard/zopfli-ffi)
|
2
5
|
|
3
6
|
Ruby wrapper for [Zopfli](https://code.google.com/p/zopfli/) library. Zopfli Compression Algorithm is a new zlib (gzip, deflate) compatible compressor. This compressor takes more time (~100x slower), but compresses around 5% better than zlib and better than any other zlib-compatible compressor.
|
4
7
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'zopfli_ffi'
|
2
|
+
require 'zlib'
|
3
|
+
require 'benchmark'
|
4
|
+
|
5
|
+
in_dir = File.expand_path(File.dirname(__FILE__))
|
6
|
+
out_dir = File.expand_path(File.join(File.dirname(__FILE__), "../tmp/"))
|
7
|
+
|
8
|
+
Benchmark.bm(7) do |x|
|
9
|
+
|
10
|
+
x.report("Gzip:") do
|
11
|
+
Zlib::GzipWriter.open("#{out_dir}/1.jpg.gz") do |gz|
|
12
|
+
gz.write IO.binread("#{in_dir}/1.jpg")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
x.report("Zopfli (5 iterations):") do
|
17
|
+
Zopfli.compress("#{in_dir}/1.jpg", "#{out_dir}/1_15.jpg.zfl", :zlib, 5)
|
18
|
+
end
|
19
|
+
|
20
|
+
x.report("Zopfli (50 iterations):") do
|
21
|
+
Zopfli.compress("#{in_dir}/1.jpg", "#{out_dir}/1_100.jpg.zfl", :zlib, 50)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/ext/zopfli_ffi/Rakefile
CHANGED
data/lib/zopfli/version.rb
CHANGED
data/spec/travis_build.sh
CHANGED
data/spec/zopfli_ffi_spec.rb
CHANGED
@@ -66,18 +66,14 @@ describe Zopfli do
|
|
66
66
|
uncompressed_file = "spec/fixtures/test0.txt"
|
67
67
|
compressed_file = "#{@out_dir}/test0.txt.zfl"
|
68
68
|
# made compress
|
69
|
-
fast_time = Benchmark.realtime do
|
70
|
-
Zopfli.compress(uncompressed_file, compressed_file, :zlib, 1)
|
71
|
-
end
|
72
|
-
medium_time = Benchmark.realtime do
|
73
|
-
Zopfli.compress(uncompressed_file, compressed_file, :zlib, 10)
|
74
|
-
end
|
75
69
|
slow_time = Benchmark.realtime do
|
76
70
|
Zopfli.compress(uncompressed_file, compressed_file, :zlib, 20)
|
77
71
|
end
|
72
|
+
fast_time = Benchmark.realtime do
|
73
|
+
Zopfli.compress(uncompressed_file, compressed_file, :zlib, 5)
|
74
|
+
end
|
78
75
|
|
79
|
-
expect(fast_time).to be <
|
80
|
-
expect(medium_time).to be < slow_time
|
76
|
+
expect(fast_time).to be < slow_time
|
81
77
|
end
|
82
78
|
end
|
83
79
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zopfli-ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vasiliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- LICENSE.txt
|
96
96
|
- README.md
|
97
97
|
- Rakefile
|
98
|
+
- benchmark/benchmark.rb
|
98
99
|
- ext/zopfli_ffi/Rakefile
|
99
100
|
- ext/zopfli_ffi/zopfli_ffi.c
|
100
101
|
- ext/zopfli_ffi/zopfli_ffi.h
|