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

Start migrating imported functions to the new definition style #252

Closed kateinoigakukun closed 3 months ago

kateinoigakukun commented 3 months ago

Use of different function names for C-name and Wasm's import name is a bit confusing. Also use of unprefixed function names in the C code is not a good practice. This commit starts migrating imported functions to the new naming convention and removes duplicated function definitions just for IDE support by using macro.

github-actions[bot] commented 3 months ago

Time Change: -394ms (4%)

Total Time: 9,416ms

Test name Duration Change
Serialization/JavaScript function call through Wasm import 20ms -1ms (5%)
Serialization/Swift String to JavaScript with assignment 387ms -33ms (8%)
Serialization/Swift String to JavaScript with call 985ms -50ms (5%)
Serialization/JavaScript String to Swift String 3,698ms -259ms (7%)
View Unchanged | Test name | Duration | Change | | :--- | :---: | :---: | | Serialization/JavaScript function call through Wasm import with int | 15ms | +1ms | | Serialization/JavaScript function call from Swift | 104ms | +0ms | | Serialization/Swift Int to JavaScript with assignment | 320ms | -14ms (4%) | | Serialization/Swift Int to JavaScript with call | 946ms | -36ms (3%) | | Serialization/JavaScript Number to Swift Int | 300ms | -11ms (3%) | | Object heap/Increment and decrement RC | 2,629ms | +15ms (0%) |
View Baselines | Test name | Duration | | :--- | :---: | | Serialization/Call JavaScript function directly | 4ms | | Serialization/Assign JavaScript number directly | 2ms | | Serialization/Call with JavaScript number directly | 3ms | | Serialization/Write JavaScript string directly | 2ms | | Serialization/Call with JavaScript string directly | 2ms |