| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ates and callbacks
Performance (JS -> runtime -> DotNetBridge -> BCL):
- The bridge makes a COM pointer eagerly only for C#/WinRT objects and JS subclass instances;
other objects get one when first passed to a WinRT API. The wrapper was two thirds of the
cost of constructing or returning an object.
- Responses go to a reusable per-thread buffer instead of a fresh AllocHGlobal per call.
- Type, assembly and member names come from a per-thread decode cache. Argument strings are no
longer string.Intern'd, which took a global lock and kept every string passed to .NET alive.
- Box, ResolveType and property lookups no longer reflect or allocate per call.
- JS proxies look members up in per-type maps instead of scanning member lists, and reuse
method functions and resolved assemblies. Responses are read in place in Rust.
Bridge-only cost: property get 196 -> 98 ns, static call 397 -> 213 ns, overloaded call
4.3 us -> 424 ns, construct + release 1331 -> 284 ns.
Fixes:
- Overloads and constructors resolve by how well the arguments fit, not the first one they
convert to: Math.Abs(-0.5) returned 0, Math.Max(3.5, 2) returned 4, Math.Abs(-128) could
overflow and new StringBuilder('q') threw.
- Collections other than arrays (List<T>, ArrayList, Dictionary, ObservableCollection) stay .NET
objects with their methods, and act like arrays in JS: length, list[i], for...of, map,
filter, JSON.stringify. They used to come back as array copies, so list.Add was impossible.
- DateTime, DateTimeOffset and TimeSpan are objects with their members (span.TotalMilliseconds)
instead of ToString() strings; String(value) still gives that string. A JS Date converts to
DateTime/DateTimeOffset parameters, and strings parse for those and for Guid.
- params arrays work (String.Join(',', 'a', 'b')), and JS arrays convert to array and collection
parameters instead of being stringified.
- A JS function passed as a delegate gets .NET objects as arguments, not raw handles.
- Plain JS fields set on .NET objects and namespaces are kept; '' + obj no longer throws.
- get_Item(key) with an argument calls the indexer; indexers aren't listed as properties.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command. ⚙️ Run configuration
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file. Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Speeds up calls from JS into .NET through the DotNetBridge (classic and Node-API engines), and fixes several marshaling bugs found while benchmarking.
Performance
Bridge-only cost per call (BenchmarkDotNet, through the real InvokeBinary entry point, new AbiBenchmarks):
End to end on classic V8 (each op in its own process, medians of 3; this machine is noisy, ±20%): static calls 1.4x, overloaded calls 2.6x, constructing/returning objects 2.0–2.2x, property get/set 1.3x, member resolution 4.5x. The Node-API engine under Node shows the same pattern.
What changed:
Fixes
Compatibility
Testing