-
Notifications
You must be signed in to change notification settings - Fork 29
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
Make compilation 2x faster by using literals #65
Conversation
This looks like a complete revert of #51 minus changes in two lines of comments. I don't work on this project any more so I'll defer to @dannys42 to decide if 5.0 support is still needed. |
Thanks @KKK669 for the submission and @youming-lin for the context. I've been slowly phasing out Swift 5.0 and 5.1 from the various Kitura projects. My typical approach has been to bump the major version of the project while simultaneously dropping support for older versions of Swift and updating the CI build. So let me take a stab at that then revisit this. I'll try to address this as soon as I can. But I apologize right now if I don't get to this soon, I'm a bit overloaded right now. Feel free to ping a reminder to me if I'm taking too long. |
@youming-lin Thank you for sharing the related issue. I also replaced @dannys42 Thank you for sharing the future plan. I'm going to wait until then. |
@KKK669 I see one difference on line 457 from your changes vs @youming-lin's on the last character of the line. Can you confirm what the correct value should be?
|
Also, please rebase if you can. |
6d490b0
to
4348a95
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
I rebased now.
It seems that the value of |
I think the values should be left as they are even if it is an incorrect value. By doing so, this PR becomes a simple conversion-only difference. If |
I originally generated the maps from a JSON file I found that maps the named character references to unicodes, e.g. https://html.spec.whatwg.org/entities.json I would doublecheck the spec to make sure the unicodes are correct. |
@youming-lin Thank you for sharing the specs. I checked it and I confirmed that #51's change was incorrect. However, I haven't made any changes to that part in this PR, so if I fix it here, I think it would be out of line with the purpose of this PR. |
@KKK669 Sounds good. That's for your PR and all the research! |
@KKK669 I pushed your changes and made a release for 4.0.1. I also added an issue to track the unicode bug. Please feel free to add any context you think is necessary for that issue. Or submit a new PR if you're inclined. :-) There's an issue with cocoapods so I can't push an updated pod right now. I'll try again later. |
Thank you so much! I will send a PR for #67 when I have time. But if someone else sends a PR earlier than me, I don’t mind. |
Description
I replaced
Character(Unicode.Scalar(...)!)
by"\u{...}"
. This makes compilation almost 2x faster.Here is the benchmark:
swift build
swift build
swift build -c release
swift build -c release
(Mac mini (M1, 2020) 8GB RAM, macOS 12.3, Xcode 13.3, Swift 5.6)
Motivation and Context
My changes can reduce compile time without changing any functionality.
Not only that, these can also resolve issues like kkebo/DevToys.swiftpm#6 (comment).
How Has This Been Tested?
Checklist: