swiftwasm / JavaScriptKit

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

Add Int64/UInt64 to Bigint slow conversion #204

Closed kateinoigakukun closed 2 years ago

kateinoigakukun commented 2 years ago

Int64 -> BigInt conversion can be done by passing two i32 without i64-bigint integration feature. This is a slow path, but useful for environments that have BigInt but don't have i64-bigint integration.

github-actions[bot] commented 2 years ago

Time Change: -276ms (1%)

Total Time: 19,142ms

Test name Duration Change
Serialization/Call JavaScript function directly 3ms +1ms 🚨
Serialization/Assign JavaScript number directly 3ms -1ms 🎉
Serialization/Call with JavaScript number directly 6ms +3ms (47%) 🚨
Serialization/Write JavaScript string directly 2ms -1ms (52%) 🏆
Serialization/Call with JavaScript string directly 4ms +2ms (44%) 🚨
Serialization/JavaScript function call through Wasm import 19ms +1ms (6%) 🔍
Serialization/JavaScript function call through Wasm import with int 17ms -3ms (19%) 👏
View Unchanged | Test name | Duration | Change | | :--- | :---: | :---: | | Serialization/JavaScript function call from Swift | 567ms | +7ms (1%) | | Serialization/Swift Int to JavaScript with assignment | 388ms | -1ms | | Serialization/Swift Int to JavaScript with call | 2,120ms | -44ms (2%) | | Serialization/JavaScript Number to Swift Int | 585ms | -3ms (0%) | | Serialization/Swift String to JavaScript with assignment | 447ms | -1ms | | Serialization/Swift String to JavaScript with call | 2,243ms | -23ms (1%) | | Serialization/JavaScript String to Swift String | 5,388ms | -151ms (2%) | | Object heap/Increment and decrement RC | 7,350ms | -63ms (0%) |
kateinoigakukun commented 2 years ago

Yes, the variant choice would be made in caller side for now.

kateinoigakukun commented 2 years ago

BTW, some of the benchmark cases are too fast and cause meaningless reports...