embedding_go_in_a_gem 0.1.1-x86_64-darwin-20
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 +7 -0
- data/MIT-LICENSE +21 -0
- data/README.md +146 -0
- data/ext/sample-go-program +0 -0
- data/lib/.gemkeep +0 -0
- data/lib/embedding_go_in_a_gem.rb +6 -0
- data/spec/gem_spec.rb +1 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 78ed264ee08d321e161aff9bbf18f3245bbfb3a44b04afcc0af60f4e908b8ea1
|
4
|
+
data.tar.gz: 75e55a4557dda47666222f904d547fe265c15411adb14a5d609acac21be1668f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1549719468e2487bf2072a9b2d99a3b507414a9fae9e718099e6d46e13c5af2fadbda24349fa0e12d2455ff56f61e2132cae9891f3a6361ab2409a4e2e571af7
|
7
|
+
data.tar.gz: dea6b9ffe02439d0edc02f47e1c5fcb052c0cd5a2ee2fb70649fe1254b48cc9cb3f7861f109513d831f8b7cf93bd080fb6edc86b234147b052aa16cf991e963d
|
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
|
+
[](http://badge.fury.io/rb/fast_blank) [](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))
|
Binary file
|
data/lib/.gemkeep
ADDED
File without changes
|
data/spec/gem_spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: embedding_go_in_a_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: x86_64-darwin-20
|
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: rspec
|
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
|
+
description: Can you embed a binary in a Gem? Can you distribute it to multiple architectures?
|
28
|
+
email: stephen@infinitecanvas.net
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- MIT-LICENSE
|
34
|
+
- README.md
|
35
|
+
- ext/sample-go-program
|
36
|
+
- lib/.gemkeep
|
37
|
+
- lib/embedding_go_in_a_gem.rb
|
38
|
+
- spec/gem_spec.rb
|
39
|
+
homepage: https://github.com/linux2647/embedding-go-in-a-gem
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubygems_version: 3.2.3
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Can you embed a binary in a Gem?
|
62
|
+
test_files:
|
63
|
+
- spec/gem_spec.rb
|