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

Add load_into_document to simdjson::dom::parser #2103

Merged
merged 1 commit into from Jan 9, 2024

Conversation

Bo98
Copy link
Contributor

@Bo98 Bo98 commented Jan 6, 2024

I've found parse_into_document quite useful, but there was previously no load counterpart to parse_into_document. It seemed simple enough to add so this PR does exactly that.

@lemire
Copy link
Member

lemire commented Jan 7, 2024

Running tests...

@@ -452,14 +452,18 @@ namespace parse_api_tests {
element doc_root1 = parser.parse_into_document(doc, input);
if(simdjson::to_string(doc_root1) != "[1,2,3]") { return false; }
//... doc_root1 is a pointer inside doc
element doc_root2 = parser.parse_into_document(doc, input);
element doc_root2 = parser.load_into_document(doc, TWITTER_JSON);
Copy link
Member

Choose a reason for hiding this comment

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

Have you thought about not replacing the existing test, but rather adding a test? I am mildly concerned that your PR reduces our testing of parse_into_document.

This is not a request for change. I'd like to have your thoughts on this.

Copy link
Contributor Author

@Bo98 Bo98 Jan 7, 2024

Choose a reason for hiding this comment

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

I guess it maybe depends if combinations matter. I could copy-paste the original test and make it load_from_document but do we want to cover scenarios of alternating between parse_into_document and load_into_document with the same parser?

I have no strong opinions either way. There's still two parse_into_document calls on the same parser in this test before and after, but it's not two-in-a-row now so I acknowledge there's perhaps a created gap there depending on how you see it.

Copy link
Member

Choose a reason for hiding this comment

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

@Bo98 I leave this up to your judgment. I am willing to merge this as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is probably fine I reckon

@lemire lemire merged commit 02bee7d into simdjson:master Jan 9, 2024
41 of 42 checks passed
@lemire
Copy link
Member

lemire commented Jan 9, 2024

Merged.

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.

None yet

2 participants