isomorfeus-speednode 0.5.3 → 0.6.1
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
- data/README.md +2 -2
- data/lib/isomorfeus/execjs_module.rb +4 -0
- data/lib/isomorfeus/execjs_runtime.rb +5 -0
- data/lib/isomorfeus/speednode/runner.js +14 -0
- data/lib/isomorfeus/speednode/runtime/context.rb +8 -0
- data/lib/isomorfeus/speednode/runtime/vm.rb +5 -1
- data/lib/isomorfeus/speednode/runtime/vm_command.rb +2 -2
- data/lib/isomorfeus/speednode/version.rb +1 -1
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59fdae16925c182e3d86602153873a69f6a507d27d702a8405b70b191854a821
|
4
|
+
data.tar.gz: faa6999fcdc0ffe5a294e975261b3a029227cd291554cd283d7e057a98b655dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '004933d5d91f7cb58bcdabe3a31ba3cf7b740dd8ebce97fe437d10c16e9e5874938db56f64520119ace1015b830b682bd552e5e9fd69dfa58f6766de14925c90'
|
7
|
+
data.tar.gz: aaa36c20a56c37c462844b8b8e4e2df57224105939ae46a1159e91d59fe5c6bc9eafeb9a9cdccbcb0735623115b2f3e0440047b3ef55807b02fd9150e75786f6
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Isomorfeus Speednode<br/>
|
4
4
|
</h1>
|
5
5
|
|
6
|
-
A fast runtime for
|
6
|
+
A fast runtime for ExecJS using node js. Works on Linux, BSDs, MacOS and Windows.
|
7
7
|
Inspired by [execjs-fastnode](https://github.com/jhawthorn/execjs-fastnode).
|
8
8
|
|
9
9
|
### Community and Support
|
@@ -137,4 +137,4 @@ To run tests:
|
|
137
137
|
- clone repo
|
138
138
|
- `cd ruby`
|
139
139
|
- `bundle install`
|
140
|
-
- `bundle exec rake test`
|
140
|
+
- `bundle exec rake test`
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module ExecJS
|
2
2
|
# Abstract base class for runtimes
|
3
3
|
class Runtime
|
4
|
+
def permissive_bench(source, options = {})
|
5
|
+
context = permissive_compile("", options)
|
6
|
+
context.bench(source, options)
|
7
|
+
end
|
8
|
+
|
4
9
|
def permissive_exec(source, options = {})
|
5
10
|
context = permissive_compile("", options)
|
6
11
|
context.exec(source, options)
|
@@ -201,6 +201,7 @@ function attachFunctionSource(responder_path, context, func) {
|
|
201
201
|
function createCompatibleContext(uuid, options) {
|
202
202
|
let c = vm.createContext();
|
203
203
|
vm.runInContext('delete this.console', c, "(execjs)");
|
204
|
+
vm.runInContext('delete this.gc', c, "(execjs)");
|
204
205
|
contexts[uuid] = { context: c, options: options };
|
205
206
|
return c;
|
206
207
|
}
|
@@ -265,6 +266,19 @@ let commands = {
|
|
265
266
|
let result = vm.runInContext(attachFunctionSource(responder_path, input.context, input.func), context, { filename: "(execjs)", displayErrors: true });
|
266
267
|
return formatResult(result);
|
267
268
|
},
|
269
|
+
bench: function (input) {
|
270
|
+
if (typeof global.gc === "function") { global.gc(); }
|
271
|
+
let context = getContext(input.context);
|
272
|
+
let options = getContextOptions(input.context);
|
273
|
+
performance.mark('start_bench');
|
274
|
+
let result = vm.runInContext(input.source, context, options);
|
275
|
+
performance.mark('stop_bench');
|
276
|
+
let duration = performance.measure('bench_time', 'start_bench', 'stop_bench').duration;
|
277
|
+
performance.clearMarks();
|
278
|
+
performance.clearMeasures();
|
279
|
+
if (typeof global.gc === "function") { global.gc(); }
|
280
|
+
return formatResult({ result: result, duration: duration });
|
281
|
+
},
|
268
282
|
create: function (input) {
|
269
283
|
let context = createCompatibleContext(input.context, input.options);
|
270
284
|
let result = vm.runInContext(input.source, context, getContextOptions(input.context));
|
@@ -66,6 +66,10 @@ module Isomorfeus
|
|
66
66
|
await_result
|
67
67
|
end
|
68
68
|
|
69
|
+
def bench(source, _options = nil)
|
70
|
+
raw_bench(source) if /\S/ =~ source
|
71
|
+
end
|
72
|
+
|
69
73
|
def call(identifier, *args)
|
70
74
|
raw_eval("#{identifier}.apply(this, #{::Oj.dump(args, mode: :strict)})")
|
71
75
|
end
|
@@ -102,6 +106,10 @@ module Isomorfeus
|
|
102
106
|
|
103
107
|
protected
|
104
108
|
|
109
|
+
def raw_bench(source)
|
110
|
+
extract_result(@vm.bench(@uuid, encode(source)))
|
111
|
+
end
|
112
|
+
|
105
113
|
def raw_eval(source)
|
106
114
|
extract_result(@vm.eval(@uuid, encode(source)))
|
107
115
|
end
|
@@ -95,6 +95,10 @@ module Isomorfeus
|
|
95
95
|
command('exec', {'context' => context, 'source' => source})
|
96
96
|
end
|
97
97
|
|
98
|
+
def bench(context, source)
|
99
|
+
command('bench', {'context' => context, 'source' => source})
|
100
|
+
end
|
101
|
+
|
98
102
|
def create(context, source, options)
|
99
103
|
command('create', {'context' => context, 'source' => source, 'options' => options})
|
100
104
|
end
|
@@ -141,7 +145,7 @@ module Isomorfeus
|
|
141
145
|
@socket_dir = Dir.mktmpdir("iso-speednode-")
|
142
146
|
@socket_path = File.join(@socket_dir, "socket")
|
143
147
|
end
|
144
|
-
@pid = Process.spawn({"SOCKET_PATH" => @socket_path}, @options[:binary], @options[:source_maps], @options[:runner_path])
|
148
|
+
@pid = Process.spawn({"SOCKET_PATH" => @socket_path}, @options[:binary], '--expose-gc', @options[:source_maps], @options[:runner_path])
|
145
149
|
|
146
150
|
retries = 500
|
147
151
|
|
@@ -27,12 +27,12 @@ module Isomorfeus
|
|
27
27
|
sent_bytes += @socket.sendmsg(message.byteslice((sent_bytes)..-1))
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
begin
|
32
32
|
result << @socket.recvmsg()[0]
|
33
33
|
end until result.end_with?("\x04")
|
34
34
|
end
|
35
|
-
::Oj.load(result.chop!,
|
35
|
+
::Oj.load(result.chop!, mode: :strict)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-speednode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: oj
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.13.23
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
36
|
+
version: 3.15.0
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.13.23
|
44
|
+
- - "<"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
46
|
+
version: 3.15.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: win32-pipe
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +78,14 @@ dependencies:
|
|
72
78
|
requirements:
|
73
79
|
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: 5.
|
81
|
+
version: 5.18.0
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
86
|
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: 5.
|
88
|
+
version: 5.18.0
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: rake
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
157
|
- !ruby/object:Gem::Version
|
152
158
|
version: '0'
|
153
159
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.4.6
|
155
161
|
signing_key:
|
156
162
|
specification_version: 4
|
157
163
|
summary: A fast ExecJS runtime based on nodejs, tuned for Isomorfeus.
|