node-ctypes 2.12.0 → 2.12.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.
- package/CHANGELOG.md +40 -1
- package/README.md +7 -4
- package/build/Release/ctypes-darwin-arm64.node +0 -0
- package/build/Release/ctypes-darwin-x64.node +0 -0
- package/build/Release/ctypes-linux-arm64-musl.node +0 -0
- package/build/Release/ctypes-linux-arm64.node +0 -0
- package/build/Release/ctypes-linux-x64-musl.node +0 -0
- package/build/Release/ctypes-linux-x64.node +0 -0
- package/build/Release/ctypes-win32-arm64.node +0 -0
- package/build/Release/ctypes-win32-x64.node +0 -0
- package/lib/index.d.ts +14 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.12.1] - 2026-11-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Executor inline wait per function**: the JavaScript thread now waits for
|
|
15
|
+
a call for about one and a half times the typical duration of its function
|
|
16
|
+
(measured on every call; shorter durations weigh more, so a slow first call
|
|
17
|
+
is forgotten in a few calls), at least `spin` and at most the new
|
|
18
|
+
`spinLimit` option (microseconds, default 500, `0` for never more than
|
|
19
|
+
`spin`); a function that usually takes longer is not waited for. Before, a
|
|
20
|
+
single backoff per executor skipped the wait for every function after a slow
|
|
21
|
+
call: a slow function alternated with fast ones (e.g. ADSI `GetColumn`
|
|
22
|
+
with `FreeColumn`) sent the fast ones through the event loop too. On that
|
|
23
|
+
pattern (one call of 65 µs and two fast calls) the overhead per round drops
|
|
24
|
+
from about 47 µs to about 18 µs. The backoff is now per function: when its
|
|
25
|
+
waits time out (e.g. where the executor thread wakes up slowly), a function
|
|
26
|
+
skips the next 1, 3, 7, ... up to 1023 waits, without affecting the others.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **Executor busy waits on a loaded machine**: the busy waits called
|
|
31
|
+
`std::this_thread::yield()`, which, with other threads ready on the same
|
|
32
|
+
core, gives the core away for a whole time slice: on a loaded machine (CI
|
|
33
|
+
VMs running test files in parallel) each call cost tens of milliseconds, 401
|
|
34
|
+
awaited calls 13 s instead of 0.13 s. The waits no longer yield, the
|
|
35
|
+
executor thread polls for the next call for at most 50 µs whatever `spin`
|
|
36
|
+
is, and the JavaScript thread stops waiting as soon as a native thread waits
|
|
37
|
+
for it (a thread-safe callback invoked by the awaited call). Under load the
|
|
38
|
+
fast path is now 3 to 5 times faster than `spin: 0`, as on an idle machine.
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- **`Executor` `spinLimit` option**, and tests for the per-function wait
|
|
43
|
+
(a function beyond `spin` within `spinLimit`, a slow function alternated
|
|
44
|
+
with a fast one, a function that becomes fast again), checking the budget
|
|
45
|
+
computed per function (independent of the speed of the machine); test fixture
|
|
46
|
+
function `fixture_busy_wait_us`.
|
|
47
|
+
|
|
10
48
|
## [2.12.0] - 2026-11-10
|
|
11
49
|
|
|
12
50
|
### Added
|
|
@@ -1233,7 +1271,8 @@ It contains breaking changes: see [Migrating from 1.x](README.md#migrating-from-
|
|
|
1233
1271
|
|
|
1234
1272
|
Initial releases.
|
|
1235
1273
|
|
|
1236
|
-
[Unreleased]: https://github.com/dmazzella/node-ctypes/compare/v2.12.
|
|
1274
|
+
[Unreleased]: https://github.com/dmazzella/node-ctypes/compare/v2.12.1...HEAD
|
|
1275
|
+
[2.12.1]: https://github.com/dmazzella/node-ctypes/compare/v2.12.0...v2.12.1
|
|
1237
1276
|
[2.12.0]: https://github.com/dmazzella/node-ctypes/compare/v2.11.1...v2.12.0
|
|
1238
1277
|
[2.11.1]: https://github.com/dmazzella/node-ctypes/compare/v2.11.0...v2.11.1
|
|
1239
1278
|
[2.11.0]: https://github.com/dmazzella/node-ctypes/compare/v2.10.0...v2.11.0
|
package/README.md
CHANGED
|
@@ -136,13 +136,16 @@ await executor.close(); // waits for the accepted calls, then stops the thread
|
|
|
136
136
|
and stops the thread (an executor cannot be reopened).
|
|
137
137
|
- `executor.pending`, `completed`, `running` and `closed` report its state.
|
|
138
138
|
- `spin` (microseconds, default 50, `0` to disable): after a call the thread
|
|
139
|
-
polls for the next one this long before sleeping, and the JavaScript thread
|
|
139
|
+
polls for the next one this long (at most 50 µs) before sleeping, and the JavaScript thread
|
|
140
140
|
waits this long for a call submitted to an idle executor, completing it
|
|
141
141
|
without a round trip through the event loop. Awaited calls in sequence then
|
|
142
142
|
cost a few microseconds instead of tens; its errcheck may run before
|
|
143
|
-
`callOn` returns.
|
|
144
|
-
|
|
145
|
-
to
|
|
143
|
+
`callOn` returns. The wait is per function: `spin` for a function not
|
|
144
|
+
called yet, then about one and a half times its measured typical duration,
|
|
145
|
+
up to `spinLimit` (microseconds, default 500); a function that usually takes
|
|
146
|
+
longer completes through the event loop without delaying the others. Inline
|
|
147
|
+
completions are limited to 1 ms per turn of the event loop, so timers, I/O
|
|
148
|
+
and UI events keep running.
|
|
146
149
|
- A call that has started cannot be interrupted: the signal only removes
|
|
147
150
|
queued calls.
|
|
148
151
|
- On process exit (or worker termination) queued calls are discarded and a
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/index.d.ts
CHANGED
|
@@ -752,13 +752,22 @@ export interface ExecutorOptions {
|
|
|
752
752
|
/**
|
|
753
753
|
* Busy-wait budget in microseconds (default 50, 0 to disable, at most
|
|
754
754
|
* 10000). After a call the executor thread polls for the next one this long
|
|
755
|
-
* before sleeping, and the JavaScript thread waits
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
755
|
+
* (at most 50 µs) before sleeping, and the JavaScript thread waits for a call submitted to
|
|
756
|
+
* an idle executor, completing it without a round trip through the event
|
|
757
|
+
* loop: awaited calls in sequence cost a few microseconds instead of tens.
|
|
758
|
+
* The JavaScript thread waits `spin` for a function not called yet; then,
|
|
759
|
+
* per function, about one and a half times its typical duration (measured
|
|
760
|
+
* on every call), at least `spin` and at most {@link spinLimit}. A function
|
|
761
|
+
* that usually takes longer is not waited for: its calls complete through
|
|
762
|
+
* the event loop, without delaying the others.
|
|
760
763
|
*/
|
|
761
764
|
spin?: number;
|
|
765
|
+
/**
|
|
766
|
+
* Longest wait in microseconds for a function that usually takes longer
|
|
767
|
+
* than {@link spin} (default 500, at most 10000; 0: never more than
|
|
768
|
+
* `spin`).
|
|
769
|
+
*/
|
|
770
|
+
spinLimit?: number;
|
|
762
771
|
}
|
|
763
772
|
|
|
764
773
|
/**
|