Skip to content

Optimizes parsing of large non-UTF8 queries #112

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Sources/GraphQL/Language/Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
* but is mostly useful for clients who store GraphQL documents in
* source files; for example, if the GraphQL input is in a file Foo.graphql,
* it might be useful for name to be "Foo.graphql".
*
* Note that since Source parsing is heavily UTF8 dependent, the body
* is converted into contiguous UTF8 bytes if necessary for optimal performance.
*/
public struct Source {
public let body: String
public let name: String

public init(body: String, name: String = "GraphQL") {
self.body = body
var utf8Body = body
utf8Body.makeContiguousUTF8()

self.body = utf8Body
self.name = name
}
}
Expand Down