Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime Performance Optimization #207

Merged
merged 20 commits into from
Aug 18, 2022
Merged

Runtime Performance Optimization #207

merged 20 commits into from
Aug 18, 2022

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Aug 16, 2022

  • Reduce unnecessary calls of memory and dataView getter in runtime TS code
  • Promote result pointer to return value to reduce memory operations
  • Reduce Swift ARC retain/release operations by:
    • Reduce Optional wrapper
    • Reduce reference escapes
  • Add fast paths for empty arguments call

@github-actions
Copy link

github-actions bot commented Aug 16, 2022

Time Change: -3,602ms (19%) 👏

Total Time: 18,757ms

Test name Duration Change
Serialization/Call JavaScript function directly 4ms +1ms ⚠️
Serialization/Assign JavaScript number directly 5ms +2ms (37%) 🚨
Serialization/Call with JavaScript number directly 5ms -1ms 👏
Serialization/Write JavaScript string directly 4ms +2ms (37%) 🚨
Serialization/JavaScript function call from Swift 195ms -464ms (238%) 🏆
Serialization/Swift Int to JavaScript with call 1,536ms -1,056ms (68%) 🏆
Serialization/JavaScript Number to Swift Int 468ms -221ms (47%) 🎉
Serialization/Swift String to JavaScript with call 1,673ms -1,051ms (62%) 🏆
Object heap/Increment and decrement RC 7,844ms -512ms (6%)
View Unchanged
Test name Duration Change
Serialization/Call with JavaScript string directly 3ms -0ms
Serialization/JavaScript function call through Wasm import 25ms +0ms
Serialization/JavaScript function call through Wasm import with int 20ms +0ms
Serialization/Swift Int to JavaScript with assignment 421ms -14ms (3%)
Serialization/Swift String to JavaScript with assignment 488ms -15ms (3%)
Serialization/JavaScript String to Swift String 6,067ms -272ms (4%)

Runtime/src/index.ts Outdated Show resolved Hide resolved
@kateinoigakukun kateinoigakukun marked this pull request as ready for review August 18, 2022 10:58
@kateinoigakukun kateinoigakukun requested a review from a team August 18, 2022 10:58
Runtime/src/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work, these are very impressive improvements! 👏

I only have a couple of suggestions for improving doc comments, but otherwise this LGTM.

Runtime/src/index.ts Show resolved Hide resolved
Runtime/src/js-value.ts Outdated Show resolved Hide resolved
Sources/_CJavaScriptKit/include/_CJavaScriptKit.h Outdated Show resolved Hide resolved
Sources/_CJavaScriptKit/include/_CJavaScriptKit.h Outdated Show resolved Hide resolved
Sources/_CJavaScriptKit/include/_CJavaScriptKit.h Outdated Show resolved Hide resolved
Sources/_CJavaScriptKit/include/_CJavaScriptKit.h Outdated Show resolved Hide resolved
Sources/_CJavaScriptKit/include/_CJavaScriptKit.h Outdated Show resolved Hide resolved
@kateinoigakukun kateinoigakukun merged commit 1afbfaf into main Aug 18, 2022
@kateinoigakukun kateinoigakukun deleted the katei/perf-opt branch August 18, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants