-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Syntax] Don't pretty-print -emit-syntax JSON output #15380
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
[Syntax] Don't pretty-print -emit-syntax JSON output #15380
Conversation
3553ff8
to
eea8e29
Compare
Does it hurt to keep it pretty? The test is more readable that way. |
The test is definitely more readable, but it significantly increases the file size of the JSON, which makes a difference when deserializing. Prettyprinted, |
Yeah, i see your argument of keeping the serialization format slim, but can we make it optional? pretty-print can be opt-in for testing and debugging; and the default is the slim version for actual serialization. |
I could also just leave |
that's fair. Thanks! |
could you apply the same optimization for SourceKitd? it's https://github.com/apple/swift/blob/master/tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp#L1801 |
eea8e29
to
5f6c17d
Compare
|
8920cd7
to
737bd43
Compare
@swift-ci please smoke test |
Can we compare the output with Swiftc instead? |
@swift-ci please smoke test |
059d2b1
to
f0b5a61
Compare
f0b5a61
to
42506bc
Compare
@swift-ci please smoke test |
This patch turns off pretty-printing for
swiftc -frontend -emit-syntax
. Since these structures nest very deep, there's a LOT of wasted memory printing' '
characters, and wasted parse time skipping them, which slows down deserialization in SwiftSyntax.