Skip to content

What happens if the json string is not padded? #2195

Answered by jkeiser
Gun9niR asked this question in Q&A
Discussion options

You must be logged in to vote

Do you control the initial allocation of the buffer you read your JSON into, and can you pad that initial allocation a bit to match?

There isn't currently a great workaround -- you can use the fallback parser but it doesn't use simd and is slower. There are a couple of reasons we need padding, but one important reason is that we can do faster string processing by reading 8-64 bytes at a time, including when we are at the end of the string (we just retroactively cap the string when we find the end quote).

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@Gun9niR
Comment options

@jkeiser
Comment options

Answer selected by Gun9niR
Comment options

You must be logged in to vote
2 replies
@Gun9niR
Comment options

@jkeiser
Comment options

Comment options

You must be logged in to vote
1 reply
@jkeiser
Comment options

Comment options

You must be logged in to vote
2 replies
@Gun9niR
Comment options

@lemire
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants