RubyInline 3.14.3 → 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} +9 -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 +2 -2
- data.tar.gz.sig +0 -0
- metadata +10 -10
- 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,12 @@
|
|
|
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
|
+
|
|
1
10
|
=== 3.14.3 / 2026-02-02
|
|
2
11
|
|
|
3
12
|
* 1 bug fix:
|
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')
|
|
@@ -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
|
|
@@ -103,13 +103,13 @@ email:
|
|
|
103
103
|
executables: []
|
|
104
104
|
extensions: []
|
|
105
105
|
extra_rdoc_files:
|
|
106
|
-
- History.
|
|
106
|
+
- History.rdoc
|
|
107
107
|
- Manifest.txt
|
|
108
|
-
- README.
|
|
108
|
+
- README.rdoc
|
|
109
109
|
files:
|
|
110
|
-
- History.
|
|
110
|
+
- History.rdoc
|
|
111
111
|
- Manifest.txt
|
|
112
|
-
- README.
|
|
112
|
+
- README.rdoc
|
|
113
113
|
- Rakefile
|
|
114
114
|
- demo/fastmath.rb
|
|
115
115
|
- demo/hello.rb
|
|
@@ -119,23 +119,23 @@ files:
|
|
|
119
119
|
- test/test_inline.rb
|
|
120
120
|
- tutorial/example1.rb
|
|
121
121
|
- tutorial/example2.rb
|
|
122
|
-
homepage:
|
|
122
|
+
homepage: https://zenspider.com/projects/rubyinline.html
|
|
123
123
|
licenses:
|
|
124
124
|
- MIT
|
|
125
125
|
metadata:
|
|
126
|
-
documentation_uri:
|
|
127
|
-
homepage_uri:
|
|
126
|
+
documentation_uri: https://docs.seattlerb.org/RubyInline/
|
|
127
|
+
homepage_uri: https://zenspider.com/projects/rubyinline.html
|
|
128
128
|
source_code_uri: https://github.com/seattlerb/rubyinline
|
|
129
129
|
rdoc_options:
|
|
130
130
|
- "--main"
|
|
131
|
-
- README.
|
|
131
|
+
- README.rdoc
|
|
132
132
|
require_paths:
|
|
133
133
|
- lib
|
|
134
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
138
|
+
version: '3.2'
|
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
requirements:
|
|
141
141
|
- - ">="
|
metadata.gz.sig
CHANGED
|
Binary file
|