sync-rpc 1.3.3 → 1.3.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.
@@ -22,3 +22,22 @@ rpc.FUNCTION_PRIORITY.forEach((fn, i) => {
22
22
  }
23
23
  });
24
24
  });
25
+ rpc.FUNCTION_PRIORITY.forEach((fn, i) => {
26
+ let longMessage = '';
27
+ for (let i = 0; i < 100000; i++) {
28
+ longMessage += 'My Long Message Content';
29
+ }
30
+ test('profile large ' + fn.name, () => {
31
+ try {
32
+ rpc.configuration.fastestFunction = fn;
33
+ const start = Date.now();
34
+ for (let i = 0; i < 10; i++) {
35
+ expect(client(longMessage)).toBe(`sent ${longMessage} to My Server`);
36
+ }
37
+ const end = Date.now();
38
+ console.log('large ' + fn.name + ': ' + (end - start));
39
+ } catch (ex) {
40
+ console.log('large ' + fn.name + ' fails');
41
+ }
42
+ });
43
+ });
package/lib/index.js CHANGED
@@ -91,7 +91,12 @@ function nativeNC(port, input) {
91
91
  }
92
92
 
93
93
  function nodeNC(port, input) {
94
- return spawnSync(process.execPath, ['-e', nodeNetCatSrc(port, input)]);
94
+ const src = nodeNetCatSrc(port, input);
95
+ if (src.length < 1000) {
96
+ return spawnSync(process.execPath, ['-e', src]);
97
+ } else {
98
+ return spawnSync(process.execPath, [], {input: src});
99
+ }
95
100
  }
96
101
 
97
102
  function test(fn, port) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sync-rpc",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "main": "lib/index.js",
5
5
  "description": "Run asynchronous commands synchronously by putting them in a separate process",
6
6
  "keywords": [],