swiftwasm / JavaScriptKit

Swift framework to interact with JavaScript through WebAssembly.
https://swiftpackageindex.com/swiftwasm/JavaScriptKit/main/documentation/javascriptkit
MIT License
664 stars 44 forks source link

Inherit JSFunction from JSClosure #239

Closed kateinoigakukun closed 5 months ago

kateinoigakukun commented 5 months ago

There is no reason not to make JSClosure to be compatible with JSFunction. We can treat JSClosure as a JSFunction and call it from not only JavaScript but also Swift.

github-actions[bot] commented 5 months ago

Time Change: +495ms (5%) 🔍

Total Time: 9,795ms

Test name Duration Change
Serialization/JavaScript function call through Wasm import 21ms +2ms (11%) ⚠️
Serialization/JavaScript function call through Wasm import with int 15ms +1ms 🔍
Serialization/JavaScript function call from Swift 102ms +5ms (5%) 🔍
Serialization/Swift Int to JavaScript with assignment 342ms +23ms (6%) 🔍
Serialization/Swift Int to JavaScript with call 1,008ms +52ms (5%) 🔍
Serialization/JavaScript Number to Swift Int 312ms +16ms (5%) 🔍
Serialization/JavaScript String to Swift String 3,838ms +217ms (5%) 🔍
View Unchanged | Test name | Duration | Change | | :--- | :---: | :---: | | Serialization/Swift String to JavaScript with assignment | 391ms | +15ms (3%) | | Serialization/Swift String to JavaScript with call | 1,059ms | +44ms (4%) | | Object heap/Increment and decrement RC | 2,694ms | +118ms (4%) |
View Baselines | Test name | Duration | | :--- | :---: | | Serialization/Call JavaScript function directly | 3ms | | Serialization/Assign JavaScript number directly | 3ms | | Serialization/Call with JavaScript number directly | 4ms | | Serialization/Write JavaScript string directly | 3ms | | Serialization/Call with JavaScript string directly | 3ms |