embedding_go_in_a_gem 0.1.8-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +21 -0
- data/README.md +146 -0
- data/bin/egiag +4 -0
- data/ext/embedding_go_in_a_gem/extconf.rb +14 -0
- data/ext/embedding_go_in_a_gem/sample-go-program +0 -0
- data/lib/embedding_go_in_a_gem.rb +6 -0
- data/spec/gem_spec.rb +1 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 84bbaca386860f9f2eb34040e91d8f5d0137e92ffcb86a1ff5df709b89cf6381
|
4
|
+
data.tar.gz: 1d20c8da384335d40729b46d68dc70acf46935fe38021d2b370aa9a517c24942
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39ad6f97c5e96e787a864005e052736df074398daf0ea7854ff91c810df457ebc16cbf1ee23f3a84019508ae8e9babe9d141b9f31eaa5686e97b8d398266ce75
|
7
|
+
data.tar.gz: c5dca6466ee325c1697c55298f23a4b37819d5c11872933f0d4a969cf9f3d26daae545bbba0a8e6f8fc6a5add66c54de22d8645ea991c6f93b527b8af6e62e00
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2006-2009 Steve Sloan
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
### `String#blank?` Ruby Extension
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/fast_blank.png)](http://badge.fury.io/rb/fast_blank) [![Build Status](https://travis-ci.org/SamSaffron/fast_blank.png?branch=master)](https://travis-ci.org/SamSaffron/fast_blank)
|
4
|
+
|
5
|
+
`fast_blank` is a simple C extension which provides a fast implementation of [Active Support's `String#blank?` method](http://api.rubyonrails.org/classes/String.html#method-i-blank-3F).
|
6
|
+
|
7
|
+
### How do you use it?
|
8
|
+
|
9
|
+
require 'fast_blank'
|
10
|
+
|
11
|
+
or add it to your Bundler Gemfile
|
12
|
+
|
13
|
+
gem 'fast_blank'
|
14
|
+
|
15
|
+
### How fast is "Fast"?
|
16
|
+
|
17
|
+
About 1.2–20x faster than Active Support on my machine (your mileage my vary, depends on string length):
|
18
|
+
|
19
|
+
```
|
20
|
+
$ bundle exec ./benchmark
|
21
|
+
|
22
|
+
================== Test String Length: 0 ==================
|
23
|
+
Calculating -------------------------------------
|
24
|
+
Fast Blank 225.251k i/100ms
|
25
|
+
Fast ActiveSupport 225.676k i/100ms
|
26
|
+
Slow Blank 110.934k i/100ms
|
27
|
+
New Slow Blank 221.792k i/100ms
|
28
|
+
-------------------------------------------------
|
29
|
+
Fast Blank 29.673M (± 2.7%) i/s - 148.215M
|
30
|
+
Fast ActiveSupport 28.249M (± 3.5%) i/s - 141.048M
|
31
|
+
Slow Blank 2.158M (± 3.3%) i/s - 10.872M
|
32
|
+
New Slow Blank 23.558M (± 3.2%) i/s - 117.772M
|
33
|
+
|
34
|
+
Comparison:
|
35
|
+
Fast Blank: 29673200.1 i/s
|
36
|
+
Fast ActiveSupport: 28248894.5 i/s - 1.05x slower
|
37
|
+
New Slow Blank: 23557900.0 i/s - 1.26x slower
|
38
|
+
Slow Blank: 2157787.7 i/s - 13.75x slower
|
39
|
+
|
40
|
+
|
41
|
+
================== Test String Length: 6 ==================
|
42
|
+
Calculating -------------------------------------
|
43
|
+
Fast Blank 201.185k i/100ms
|
44
|
+
Fast ActiveSupport 205.076k i/100ms
|
45
|
+
Slow Blank 102.061k i/100ms
|
46
|
+
New Slow Blank 123.087k i/100ms
|
47
|
+
-------------------------------------------------
|
48
|
+
Fast Blank 13.894M (± 2.3%) i/s - 69.409M
|
49
|
+
Fast ActiveSupport 14.627M (± 3.5%) i/s - 73.212M
|
50
|
+
Slow Blank 1.943M (± 2.3%) i/s - 9.798M
|
51
|
+
New Slow Blank 2.796M (± 1.8%) i/s - 14.032M
|
52
|
+
|
53
|
+
Comparison:
|
54
|
+
Fast ActiveSupport: 14627063.7 i/s
|
55
|
+
Fast Blank: 13893631.2 i/s - 1.05x slower
|
56
|
+
New Slow Blank: 2795783.3 i/s - 5.23x slower
|
57
|
+
Slow Blank: 1943025.9 i/s - 7.53x slower
|
58
|
+
|
59
|
+
|
60
|
+
================== Test String Length: 14 ==================
|
61
|
+
Calculating -------------------------------------
|
62
|
+
Fast Blank 220.004k i/100ms
|
63
|
+
Fast ActiveSupport 219.716k i/100ms
|
64
|
+
Slow Blank 147.399k i/100ms
|
65
|
+
New Slow Blank 106.651k i/100ms
|
66
|
+
-------------------------------------------------
|
67
|
+
Fast Blank 24.949M (± 3.0%) i/s - 124.742M
|
68
|
+
Fast ActiveSupport 24.491M (± 3.3%) i/s - 122.382M
|
69
|
+
Slow Blank 4.292M (± 1.6%) i/s - 21.520M
|
70
|
+
New Slow Blank 2.115M (± 2.4%) i/s - 10.665M
|
71
|
+
|
72
|
+
Comparison:
|
73
|
+
Fast Blank: 24948558.8 i/s
|
74
|
+
Fast ActiveSupport: 24491245.1 i/s - 1.02x slower
|
75
|
+
Slow Blank: 4292490.5 i/s - 5.81x slower
|
76
|
+
New Slow Blank: 2115097.6 i/s - 11.80x slower
|
77
|
+
|
78
|
+
|
79
|
+
================== Test String Length: 24 ==================
|
80
|
+
Calculating -------------------------------------
|
81
|
+
Fast Blank 206.555k i/100ms
|
82
|
+
Fast ActiveSupport 208.513k i/100ms
|
83
|
+
Slow Blank 137.733k i/100ms
|
84
|
+
New Slow Blank 101.215k i/100ms
|
85
|
+
-------------------------------------------------
|
86
|
+
Fast Blank 16.761M (± 2.7%) i/s - 83.861M
|
87
|
+
Fast ActiveSupport 17.710M (± 3.2%) i/s - 88.618M
|
88
|
+
Slow Blank 3.744M (± 2.0%) i/s - 18.732M
|
89
|
+
New Slow Blank 1.962M (± 2.7%) i/s - 9.818M
|
90
|
+
|
91
|
+
Comparison:
|
92
|
+
Fast ActiveSupport: 17709936.5 i/s
|
93
|
+
Fast Blank: 16760839.7 i/s - 1.06x slower
|
94
|
+
Slow Blank: 3744048.4 i/s - 4.73x slower
|
95
|
+
New Slow Blank: 1961831.1 i/s - 9.03x slower
|
96
|
+
|
97
|
+
|
98
|
+
================== Test String Length: 136 ==================
|
99
|
+
Calculating -------------------------------------
|
100
|
+
Fast Blank 201.772k i/100ms
|
101
|
+
Fast ActiveSupport 189.120k i/100ms
|
102
|
+
Slow Blank 129.439k i/100ms
|
103
|
+
New Slow Blank 90.677k i/100ms
|
104
|
+
-------------------------------------------------
|
105
|
+
Fast Blank 16.718M (± 2.8%) i/s - 83.534M
|
106
|
+
Fast ActiveSupport 17.617M (± 3.6%) i/s - 87.941M
|
107
|
+
Slow Blank 3.725M (± 3.0%) i/s - 18.639M
|
108
|
+
New Slow Blank 1.940M (± 4.8%) i/s - 9.702M
|
109
|
+
|
110
|
+
Comparison:
|
111
|
+
Fast ActiveSupport: 17616782.1 i/s
|
112
|
+
Fast Blank: 16718307.8 i/s - 1.05x slower
|
113
|
+
Slow Blank: 3725097.6 i/s - 4.73x slower
|
114
|
+
New Slow Blank: 1940271.2 i/s - 9.08x slower
|
115
|
+
|
116
|
+
|
117
|
+
```
|
118
|
+
|
119
|
+
Additionally, this gem allocates no strings during the test, making it less of a GC burden.
|
120
|
+
|
121
|
+
### Compatibility note:
|
122
|
+
|
123
|
+
`fast_blank` supports MRI Ruby 1.9.3, 2.0, 2.1, and 2.2, as well as Rubinius 2.x. Earlier versions of MRI are untested.
|
124
|
+
|
125
|
+
`fast_blank` implements `String#blank?` as MRI would have implemented it, meaning it has 100% parity with `String#strip.length == 0`.
|
126
|
+
|
127
|
+
Active Support's version also considers Unicode spaces. For example, `"\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000".blank?` is true in Active Support even though `fast_blank` would treat it as *not* blank. Therefore, `fast_blank` also provides `blank_as?` which is a 100%-compatible Active Support `blank?` replacement.
|
128
|
+
|
129
|
+
### Credits
|
130
|
+
|
131
|
+
* Author: Sam Saffron (sam.saffron@gmail.com)
|
132
|
+
* https://github.com/SamSaffron/fast_blank
|
133
|
+
* License: MIT
|
134
|
+
* Gem template based on [CodeMonkeySteve/fast_xor](https://github.com/CodeMonkeySteve/fast_xor)
|
135
|
+
|
136
|
+
### Change log:
|
137
|
+
|
138
|
+
1.0.1:
|
139
|
+
- Minor, avoid warnings if redefining blank?
|
140
|
+
|
141
|
+
1.0.0:
|
142
|
+
- Adds Ruby 2.2 support ([@tjschuck](https://github.com/tjschuck) — [#9](https://github.com/SamSaffron/fast_blank/pull/9))
|
143
|
+
|
144
|
+
0.0.2:
|
145
|
+
- Removed rake dependency ([@tmm1](https://github.com/tmm1) — [#2](https://github.com/SamSaffron/fast_blank/pull/2))
|
146
|
+
- Unrolled internal loop to improve perf ([@tmm1](https://github.com/tmm1) — [#2](https://github.com/SamSaffron/fast_blank/pull/2))
|
data/bin/egiag
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
dir = File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
File.write "Makefile", <<MAKEFILE
|
4
|
+
build:
|
5
|
+
GOBIN="#{dir}" go install github.com/linux2647/sample-go-program@v0.1.0
|
6
|
+
|
7
|
+
all: install
|
8
|
+
clean:
|
9
|
+
install:
|
10
|
+
@touch embedding_go_in_a_gem.bundle
|
11
|
+
@touch embedding_go_in_a_gem.so
|
12
|
+
MAKEFILE
|
13
|
+
|
14
|
+
$makefile_created = true
|
Binary file
|
data/spec/gem_spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: embedding_go_in_a_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.8
|
5
|
+
platform: x86_64-darwin
|
6
|
+
authors:
|
7
|
+
- Stephen Howell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake-compiler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Can you embed a binary in a Gem? Can you distribute it to multiple architectures?
|
42
|
+
email: stephen@infinitecanvas.net
|
43
|
+
executables:
|
44
|
+
- egiag
|
45
|
+
extensions:
|
46
|
+
- ext/embedding_go_in_a_gem/extconf.rb
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- MIT-LICENSE
|
50
|
+
- README.md
|
51
|
+
- bin/egiag
|
52
|
+
- ext/embedding_go_in_a_gem/extconf.rb
|
53
|
+
- ext/embedding_go_in_a_gem/sample-go-program
|
54
|
+
- lib/embedding_go_in_a_gem.rb
|
55
|
+
- spec/gem_spec.rb
|
56
|
+
homepage: https://github.com/linux2647/embedding-go-in-a-gem
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubygems_version: 3.2.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Can you embed a binary in a Gem?
|
79
|
+
test_files:
|
80
|
+
- spec/gem_spec.rb
|