Repository navigation
Conversation
A page of documents went BSON, canonical Extended JSON, JSONSerialization and an unwrap pass, and the text was then parsed again for the row locator, the nested cells and the export copy, plus bson_new_from_json only for the size. One bson_iter pass now gives the values, the canonical tree, the locator and the size; a cursor batch keeps the BSON bytes and makes text only for JavaScript. Signposts mark the shell, the cursor read, the decode and the grid build.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MongoBsonDocumentReader). One pass per document gives the Swift values the grid and the kind caches take, the canonical Extended JSON tree in stored field order, the_idlocator and the stored size. Before, each document went BSON, canonical Extended JSON text,JSONSerialization, an unwrap pass, and then the text was parsed again for the locator, the nested cells and the export copy, plusbson_new_from_jsononly to read its size.bsonToDict, the sampling find) use the same reader.%.20grule. A repeated field name, compared as bytes, leaves the document without a canonical tree, as the strict text read refused it.com.TablePro,MongoDBRead) around the shell evaluation, the cursor read, the decode and the grid build, so the shell's share of a browse page can be measured in Instruments.Left for later, in a comment on #4548: building the export copy only when an export or copy asks (the host keeps it per row, so it needs a PluginKit requirement and the tab's row store), reusing the declared schema on a first page (the driver gets no signal for an explicit Refresh), the capped filtered count (needs the threshold passed through PluginKit), and browsing without the shell.
Measure
Local harness on this Mac (the plugin sources and the shipped libbson in a scratch SwiftPM package, release build, machine shared with other builds), the grid path for one page: read, locators, column and kind passes, flatten, absent cells, export copy. Persistent bytes are malloc in-use after the result lands.
Round trips and the filtered count are unchanged by this PR.
Test plan
MongoBsonDocumentReaderTests(TableProMobileTests): every BSON type, the doubles whose spelling is easy to get wrong, nested documents and arrays, a top-level$name, a NUL inside a string, a repeated name and two spellings of one character. Each document read from its BSON gives the same tree, values, locator and size as reading its canonical text did. It andMongoDBReadMemoryTestspass locally in the harness (9 tests); on CI they run in the iOS job (no simulator runtime on this Mac).MongoDBReadMemoryTestsupdated for the batch holding documents instead of text; same assertions.verify.sh plugins, the iOS test build, lint.Closes #4548