isomorfeus-speednode 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d163fe97b50cb3d23b187a384ccd95aedd2d11e7092db7e2e2866b9f882427c5
|
4
|
+
data.tar.gz: a95a2273adf37112ff71263470b4dd69843e45ad69ec730611defafe20e95d02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8070f27aec93fa9c9059f269662a1168f2544c5c97095a472f1b1e29b55bf5d564ecd334c203146bfb9923e90a8cd94d7ea3cc0cd1a8da436f2f44cd0f73f5
|
7
|
+
data.tar.gz: 05e284e4800da68388373a80620874bd624719e1baaac94633d8c61919c8c1bf4b696a6fc256eb90bfe640927a0305124306e14288483289feabb11eba439345
|
@@ -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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.13.
|
33
|
+
version: 3.13.21
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.13.
|
40
|
+
version: 3.13.21
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: win32-pipe
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 5.
|
75
|
+
version: 5.16.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 5.
|
82
|
+
version: 5.16.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.4.0.dev
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: A fast ExecJS runtime based on nodejs, tuned for Isomorfeus.
|