Developer submits PR to fix double-cloning and sequential awaits in SurrealDB
A contributor to SurrealDB identified a double-cloning inefficiency in the project's core value-processing file (core/src/val/value/get.rs), reportedly with the help of an AI tool called OpenCode. The fix eliminates a redundant clone by reusing the value already stored inside the CursorDoc structure via the into_owned() method. The contributor also flagged a performance bottleneck where asynchronous operations inside a for loop were executing sequentially, meaning 200 items at 10ms each could take up to two seconds. To address this, the code was refactored to run the futures in parallel using stk.scope and try_join_all_buffered, a pattern already present elsewhere in the SurrealDB codebase. The pull request has been submitted and is awaiting review by the SurrealDB team.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in