zopfli-ffi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da0f9bd399b19a7fd81b7fa554180f93f85b3ef9
4
- data.tar.gz: f409afccb3951669199cf577270f5f430a83cf5f
3
+ metadata.gz: 5299a7f6ea61d68c13b37d47734c5985109dbccf
4
+ data.tar.gz: ef614e49a3ff4c276bf500a91600c72318baf394
5
5
  SHA512:
6
- metadata.gz: 78a885851fd5f278603f90da1ca45d781aba88a05dac7d2ab7d4670d4edf79c93d882951334178ace0d6f71d2b13f5d3e44e44c919a5cebe16c1d04553652e99
7
- data.tar.gz: 5a2662144ec366ebbd22e67cacbbf41f7a44369e31d7f0ec1fbd1766b5c7529c31425edc19110d7b1b7de49de508bdc9cc6dab0d2bf076c3e62e1156be61e789
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.3
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 [![Build Status](https://travis-ci.org/le0pard/zopfli-ffi.svg?branch=master)](https://travis-ci.org/le0pard/zopfli-ffi)
1
+ # Zopfli-ffi
2
+
3
+ [![Build Status](https://travis-ci.org/le0pard/zopfli-ffi.svg?branch=master)](https://travis-ci.org/le0pard/zopfli-ffi)
4
+ [![Code Climate](https://codeclimate.com/github/le0pard/zopfli-ffi/badges/gpa.svg)](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
@@ -22,6 +22,8 @@ namespace "ffi-compiler" do
22
22
  c.cflags << "-arch x86_64"
23
23
  c.ldflags << "-arch x86_64"
24
24
  end
25
+ c.ldflags << ENV['LD_FLAGS'] if ENV['LD_FLAGS']
26
+ c.cflags << ENV['C_FLAGS'] if ENV['C_FLAGS']
25
27
  end
26
28
  end
27
29
  task :compile => ["ffi-compiler:default"]
@@ -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
@@ -14,4 +14,6 @@ FFI::Compiler::CompileTask.new('zopfli_ffi') do |c|
14
14
  c.cflags << "-arch x86_64"
15
15
  c.ldflags << "-arch x86_64"
16
16
  end
17
+ c.ldflags << ENV['LD_FLAGS'] if ENV['LD_FLAGS']
18
+ c.cflags << ENV['C_FLAGS'] if ENV['C_FLAGS']
17
19
  end
@@ -1,3 +1,3 @@
1
1
  module Zopfli
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/spec/travis_build.sh CHANGED
@@ -1,5 +1,4 @@
1
1
  #/usr/bin/env sh
2
2
  git clone https://github.com/Hello71/zopfli.git
3
3
  cd zopfli
4
- make && sudo make install
5
- sudo ln -fs /usr/local/lib/libzopfli.* /usr/lib/
4
+ make && make prefix=$HOME/opt install
@@ -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 < medium_time
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.0
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-10-29 00:00:00.000000000 Z
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