RubyInline 3.14.2 → 3.14.4
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
- checksums.yaml.gz.sig +0 -0
- data/{History.txt → History.rdoc} +15 -0
- data/Manifest.txt +2 -2
- data/{README.txt → README.rdoc} +9 -10
- data/Rakefile +6 -0
- data/example.rb +69 -36
- data/lib/inline.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +37 -25
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: daf49aa2a946775579f4eee7be07807a4d973dd1f75fc0089ab6d9d01b34bf64
|
|
4
|
+
data.tar.gz: b5213e341804bf548ca0938c84a4d76d357d07b9ee8b272ad485555aa7099105
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48a908c3e9ddfb471bae34e95f507dcce2d1e88161487b063c218cd692a89b08d2bf2bcf6f049850b9b753005b9f0a95b085e9c1a6932625eb7a33ac63998e64
|
|
7
|
+
data.tar.gz: 9e74af195aaa6610786e0a38d471575fe33a8423d6bbb00431334138b6408c49478a421744e5a8df942b84631cdbddce03da19cf055382010c11ce77a6743a12
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
=== 3.14.4 / 2026-03-28
|
|
2
|
+
|
|
3
|
+
* 4 bug fixes:
|
|
4
|
+
|
|
5
|
+
* Bumped ruby to 3.2+.
|
|
6
|
+
* Fix #add_id to munge id names (eg * -> times) and fix type to ID.
|
|
7
|
+
* Fixed urls, formatting, and requirements in readme.
|
|
8
|
+
* Moved History and readme from txt to rdoc files.
|
|
9
|
+
|
|
10
|
+
=== 3.14.3 / 2026-02-02
|
|
11
|
+
|
|
12
|
+
* 1 bug fix:
|
|
13
|
+
|
|
14
|
+
* Fixed regexp to handle nested parens in mingw. (fenrir-naru)
|
|
15
|
+
|
|
1
16
|
=== 3.14.2 / 2025-03-11
|
|
2
17
|
|
|
3
18
|
* 2 bug fixes:
|
data/Manifest.txt
CHANGED
data/{README.txt → README.rdoc}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= Ruby Inline
|
|
2
2
|
|
|
3
|
-
rdoc ::
|
|
4
|
-
home ::
|
|
3
|
+
rdoc :: https://docs.seattlerb.org/RubyInline/
|
|
4
|
+
home :: https://zenspider.com/projects/rubyinline.html
|
|
5
5
|
code :: https://github.com/seattlerb/rubyinline
|
|
6
6
|
|
|
7
7
|
== DESCRIPTION:
|
|
@@ -94,19 +94,18 @@ See hoe for more details.
|
|
|
94
94
|
|
|
95
95
|
== PROFILING STRATEGY:
|
|
96
96
|
|
|
97
|
-
0
|
|
98
|
-
1
|
|
99
|
-
2
|
|
100
|
-
3
|
|
101
|
-
4
|
|
102
|
-
5
|
|
97
|
+
0. Always keep a log of your progress and changes.
|
|
98
|
+
1. Run code with 'time' and large dataset.
|
|
99
|
+
2. Run code with '-rprofile' and smaller dataset, large enough to get good #s.
|
|
100
|
+
3. Examine profile output and translate 1 bottleneck to C.
|
|
101
|
+
4. Run new code with 'time' and large dataset. Repeat 2-3 if unsatisfied.
|
|
102
|
+
5. Run final code with 'time' and compare to the first run.
|
|
103
103
|
|
|
104
104
|
== REQUIREMENTS:
|
|
105
105
|
|
|
106
|
-
* Ruby
|
|
106
|
+
* Ruby >= 3.2
|
|
107
107
|
* POSIX compliant system (ie pretty much any UNIX, or Cygwin on MS platforms).
|
|
108
108
|
* A C/C++ compiler (the same one that compiled your ruby interpreter).
|
|
109
|
-
* test::unit for running tests ( http://testunit.talbott.ws/ ).
|
|
110
109
|
|
|
111
110
|
== INSTALL:
|
|
112
111
|
|
data/Rakefile
CHANGED
|
@@ -18,11 +18,17 @@ Hoe.spec "RubyInline" do
|
|
|
18
18
|
|
|
19
19
|
license "MIT"
|
|
20
20
|
|
|
21
|
+
require_ruby_version ">= 3.2"
|
|
22
|
+
|
|
21
23
|
dependency "ZenTest", "~> 4.3" # for ZenTest mapping
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
task :test => :clean
|
|
25
27
|
|
|
28
|
+
task :include do
|
|
29
|
+
puts Hoe.include_dirs.first
|
|
30
|
+
end
|
|
31
|
+
|
|
26
32
|
desc "run all examples"
|
|
27
33
|
task :examples do
|
|
28
34
|
%w(example.rb
|
data/example.rb
CHANGED
|
@@ -16,71 +16,104 @@ class MyTest
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
inline do |builder|
|
|
19
|
-
builder.c
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
int
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
builder.c <<~EOC
|
|
20
|
+
unsigned long factorial_c(int max) {
|
|
21
|
+
int i=max, result=1;
|
|
22
|
+
while (i >= 2) { result *= i--; }
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
EOC
|
|
26
|
+
|
|
27
|
+
builder.c_raw <<~EOC
|
|
28
|
+
static
|
|
29
|
+
VALUE
|
|
30
|
+
factorial_c_raw(int argc, VALUE *argv, VALUE self) {
|
|
31
|
+
int i=FIX2INT(argv[0]), result=1;
|
|
32
|
+
while (i >= 2) { result *= i--; }
|
|
33
|
+
return INT2NUM(result);
|
|
34
|
+
}
|
|
35
|
+
EOC
|
|
36
|
+
|
|
37
|
+
# header isn't published but the function isn't static?
|
|
38
|
+
builder.prefix "VALUE rb_int_mul(VALUE x, VALUE y);"
|
|
39
|
+
|
|
40
|
+
builder.add_id "*"
|
|
41
|
+
|
|
42
|
+
builder.c <<~EOC
|
|
43
|
+
VALUE factorial_c_rb(int max) {
|
|
44
|
+
int i=max;
|
|
45
|
+
VALUE result = INT2NUM(1);
|
|
46
|
+
while (i >= 2) { result = rb_funcall(result, id_times, 1, INT2FIX(i--)); }
|
|
47
|
+
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
EOC
|
|
34
51
|
end
|
|
52
|
+
|
|
53
|
+
alias factorial_alias factorial_c_raw
|
|
35
54
|
end
|
|
36
55
|
|
|
37
56
|
# breakeven for build run vs native doing 5 factorial:
|
|
38
57
|
# on a PIII/750 running FreeBSD: about 5000
|
|
39
58
|
# on a PPC/G4/800 running Mac OSX 10.2: always faster
|
|
40
59
|
|
|
41
|
-
require 'benchmark'
|
|
60
|
+
require 'benchmark/ips'
|
|
42
61
|
puts "RubyInline #{Inline::VERSION}" if $DEBUG
|
|
43
62
|
|
|
44
|
-
MyTest.
|
|
45
|
-
|
|
46
|
-
t = MyTest.new()
|
|
47
|
-
max = (ARGV.shift || 1_000_000).to_i
|
|
63
|
+
t = MyTest.new
|
|
48
64
|
n = (ARGV.shift || 5).to_i
|
|
49
|
-
m = t.factorial
|
|
65
|
+
m = t.factorial n
|
|
66
|
+
|
|
67
|
+
warn "warning: N > 12 is prolly gonna fail on the C side" if n > 12
|
|
50
68
|
|
|
51
|
-
def validate
|
|
52
|
-
|
|
69
|
+
def validate n, m
|
|
70
|
+
raise "#{n} != #{m}" unless n == m
|
|
53
71
|
end
|
|
72
|
+
validate t.factorial_c_raw(n), m if n <= 12
|
|
73
|
+
validate t.factorial_c_rb(n), m
|
|
74
|
+
validate t.factorial_alias(n), m if n <= 12
|
|
75
|
+
validate t.factorial_c(n), m if n <= 12
|
|
76
|
+
validate t.factorial(n), m
|
|
54
77
|
|
|
55
|
-
puts "
|
|
56
|
-
Benchmark
|
|
57
|
-
x.
|
|
78
|
+
puts "factorial(n = #{n}) = #{m}"
|
|
79
|
+
Benchmark.ips do |x|
|
|
80
|
+
x.config warmup: 1
|
|
81
|
+
|
|
82
|
+
x.report "null_time" do |max|
|
|
58
83
|
max.times do
|
|
59
84
|
# do nothing
|
|
60
85
|
end
|
|
61
86
|
end
|
|
62
87
|
|
|
63
|
-
x.report
|
|
88
|
+
x.report "c" do |max|
|
|
64
89
|
max.times do
|
|
65
|
-
|
|
90
|
+
t.factorial_c n
|
|
66
91
|
end
|
|
67
|
-
end
|
|
92
|
+
end if n <= 12
|
|
68
93
|
|
|
69
|
-
x.report
|
|
94
|
+
x.report "c-raw" do |max|
|
|
70
95
|
max.times do
|
|
71
|
-
|
|
96
|
+
t.factorial_c_raw n
|
|
72
97
|
end
|
|
73
|
-
end
|
|
98
|
+
end if n <= 12
|
|
74
99
|
|
|
75
|
-
x.report
|
|
100
|
+
x.report "c-alias" do |max|
|
|
76
101
|
max.times do
|
|
77
|
-
|
|
102
|
+
t.factorial_alias n
|
|
103
|
+
end
|
|
104
|
+
end if n <= 12
|
|
105
|
+
|
|
106
|
+
x.report "c-rb" do |max|
|
|
107
|
+
max.times do
|
|
108
|
+
t.factorial_c_rb n
|
|
78
109
|
end
|
|
79
110
|
end
|
|
80
111
|
|
|
81
|
-
x.report
|
|
112
|
+
x.report "pure ruby" do |max|
|
|
82
113
|
max.times do
|
|
83
|
-
|
|
114
|
+
t.factorial n
|
|
84
115
|
end
|
|
85
116
|
end
|
|
117
|
+
|
|
118
|
+
x.compare!
|
|
86
119
|
end
|
data/lib/inline.rb
CHANGED
|
@@ -65,7 +65,7 @@ class CompilationError < RuntimeError; end
|
|
|
65
65
|
# the current namespace.
|
|
66
66
|
|
|
67
67
|
module Inline
|
|
68
|
-
VERSION = "3.14.
|
|
68
|
+
VERSION = "3.14.4"
|
|
69
69
|
|
|
70
70
|
WINDOZE = /mswin|mingw/ =~ RUBY_PLATFORM
|
|
71
71
|
DEV_NULL = (WINDOZE ? 'nul' : '/dev/null')
|
|
@@ -608,7 +608,7 @@ VALUE #{method}_equals(VALUE value) {
|
|
|
608
608
|
cmd = cmd.gsub(/-Wl,-soname,\$@/, "-Wl,-soname,#{File.basename so_name}")
|
|
609
609
|
|
|
610
610
|
# strip off some makefile macros for mingw 1.9
|
|
611
|
-
cmd = cmd.gsub(
|
|
611
|
+
cmd = cmd.gsub(/\$(?<par>\((?:[^()]|\g<par>)*\))/, '') if RUBY_PLATFORM =~ /mingw/
|
|
612
612
|
|
|
613
613
|
cmd += " 2> #{DEV_NULL}" if $TESTING and not $DEBUG
|
|
614
614
|
|
|
@@ -683,7 +683,7 @@ VALUE #{method}_equals(VALUE value) {
|
|
|
683
683
|
# Registers a static id_name for the symbol :name.
|
|
684
684
|
|
|
685
685
|
def add_id name
|
|
686
|
-
self.add_static "id_#{name}", "rb_intern(\"#{name}\")"
|
|
686
|
+
self.add_static "id_#{munge name}", "rb_intern(\"#{name}\")", "ID"
|
|
687
687
|
end
|
|
688
688
|
|
|
689
689
|
##
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: RubyInline
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.14.
|
|
4
|
+
version: 3.14.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
@@ -9,9 +9,9 @@ bindir: bin
|
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
12
|
-
|
|
12
|
+
MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
|
13
13
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
|
14
|
-
|
|
14
|
+
GRYDY29tMB4XDTI2MDEwNzAxMDkxNFoXDTI3MDEwNzAxMDkxNFowRTETMBEGA1UE
|
|
15
15
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
|
16
16
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
|
17
17
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
|
@@ -21,14 +21,14 @@ cert_chain:
|
|
|
21
21
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
|
22
22
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
|
23
23
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
|
|
25
|
+
2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
|
|
26
|
+
rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
|
|
27
|
+
xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
|
|
28
|
+
6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
|
|
29
|
+
snGe1hrppvBRdcyEzvhfIPjI
|
|
30
30
|
-----END CERTIFICATE-----
|
|
31
|
-
date:
|
|
31
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
32
32
|
dependencies:
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: ZenTest
|
|
@@ -50,34 +50,34 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
53
|
+
version: '6.0'
|
|
54
54
|
- - "<"
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: '
|
|
56
|
+
version: '8'
|
|
57
57
|
type: :development
|
|
58
58
|
prerelease: false
|
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements:
|
|
61
61
|
- - ">="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: '
|
|
63
|
+
version: '6.0'
|
|
64
64
|
- - "<"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: '
|
|
66
|
+
version: '8'
|
|
67
67
|
- !ruby/object:Gem::Dependency
|
|
68
68
|
name: hoe
|
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
71
|
- - "~>"
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: '4.
|
|
73
|
+
version: '4.6'
|
|
74
74
|
type: :development
|
|
75
75
|
prerelease: false
|
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
|
78
78
|
- - "~>"
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: '4.
|
|
80
|
+
version: '4.6'
|
|
81
81
|
description: |-
|
|
82
82
|
Inline allows you to write foreign code within your ruby code. It
|
|
83
83
|
automatically determines if the code in question has changed and
|
|
@@ -87,18 +87,29 @@ description: |-
|
|
|
87
87
|
You can even write extra builders that will allow you to write inlined
|
|
88
88
|
code in any language. Use Inline::C as a template and look at
|
|
89
89
|
Module#inline for the required API.
|
|
90
|
+
|
|
91
|
+
== Features/Problems:
|
|
92
|
+
|
|
93
|
+
* Quick and easy inlining of your C or C++ code embedded in your ruby script.
|
|
94
|
+
* Extendable to work with other languages.
|
|
95
|
+
* Automatic conversion between ruby and C basic types
|
|
96
|
+
* char, unsigned, unsigned int, char *, int, long, unsigned long
|
|
97
|
+
* inline_c_raw exists for when the automatic conversion isn't sufficient.
|
|
98
|
+
* Only recompiles if the inlined code has changed.
|
|
99
|
+
* Pretends to be secure.
|
|
100
|
+
* Only requires standard ruby libraries, nothing extra to download.
|
|
90
101
|
email:
|
|
91
102
|
- ryand-ruby@zenspider.com
|
|
92
103
|
executables: []
|
|
93
104
|
extensions: []
|
|
94
105
|
extra_rdoc_files:
|
|
95
|
-
- History.
|
|
106
|
+
- History.rdoc
|
|
96
107
|
- Manifest.txt
|
|
97
|
-
- README.
|
|
108
|
+
- README.rdoc
|
|
98
109
|
files:
|
|
99
|
-
- History.
|
|
110
|
+
- History.rdoc
|
|
100
111
|
- Manifest.txt
|
|
101
|
-
- README.
|
|
112
|
+
- README.rdoc
|
|
102
113
|
- Rakefile
|
|
103
114
|
- demo/fastmath.rb
|
|
104
115
|
- demo/hello.rb
|
|
@@ -108,22 +119,23 @@ files:
|
|
|
108
119
|
- test/test_inline.rb
|
|
109
120
|
- tutorial/example1.rb
|
|
110
121
|
- tutorial/example2.rb
|
|
111
|
-
homepage:
|
|
122
|
+
homepage: https://zenspider.com/projects/rubyinline.html
|
|
112
123
|
licenses:
|
|
113
124
|
- MIT
|
|
114
125
|
metadata:
|
|
115
|
-
|
|
126
|
+
documentation_uri: https://docs.seattlerb.org/RubyInline/
|
|
127
|
+
homepage_uri: https://zenspider.com/projects/rubyinline.html
|
|
116
128
|
source_code_uri: https://github.com/seattlerb/rubyinline
|
|
117
129
|
rdoc_options:
|
|
118
130
|
- "--main"
|
|
119
|
-
- README.
|
|
131
|
+
- README.rdoc
|
|
120
132
|
require_paths:
|
|
121
133
|
- lib
|
|
122
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
135
|
requirements:
|
|
124
136
|
- - ">="
|
|
125
137
|
- !ruby/object:Gem::Version
|
|
126
|
-
version: '
|
|
138
|
+
version: '3.2'
|
|
127
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
140
|
requirements:
|
|
129
141
|
- - ">="
|
|
@@ -131,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
131
143
|
version: '0'
|
|
132
144
|
requirements:
|
|
133
145
|
- A POSIX environment and a compiler for your language.
|
|
134
|
-
rubygems_version: 3.
|
|
146
|
+
rubygems_version: 3.7.2
|
|
135
147
|
specification_version: 4
|
|
136
148
|
summary: Inline allows you to write foreign code within your ruby code
|
|
137
149
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|