Skip to content

Conversation

@jycor
Copy link
Contributor

@jycor jycor commented Nov 19, 2025

This PR expands on an optimization where we separate iter.Next() and RowToSQL + callback() into two separate threads. Now, iter.Next(), RowToSQL, and callback() all run in their own goroutines with corresponding buffered channels communicating between them.

Additionally, this PR tidys up the resultForDefaultIter and resultForValueIter code.

Benchmarks: dolthub/dolt#10103 (comment)

@jycor jycor changed the title more threads Split Iter.Next(), RowToSQL, and callback into separate threads Nov 19, 2025
@jycor jycor changed the title Split Iter.Next(), RowToSQL, and callback into separate threads Split Iter.Next(), RowToSQL, and callback into separate threads Nov 19, 2025
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

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

LGTM

})

// Drain rows from rowChan, convert to wire format, and send to resChan
var resChan = make(chan *sqltypes.Result, 4)
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for this buffer size being different than the row one

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 a buffer of *sqltypes.Result, which hold rowBatch = 128 rows each, so 512/128 = 4.

@jycor jycor merged commit 006ebc8 into main Nov 19, 2025
8 checks passed
@jycor jycor deleted the james/threads branch November 19, 2025 21:59
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.

3 participants