Repository navigation
[ML] Opt.: Load the consecutive clusters of a lazy buffer in one event loop - #23793
Merged
Merged
Conversation
… event loop The clusters of a buffer that follow each other in the same dataframe are merged into one entry range before loading, so that without shuffling a buffer is loaded in one event loop instead of one loop per cluster.
vepadulano
approved these changes
Oct 22, 2026
vepadulano
left a comment
Member
There was a problem hiding this comment.
Agreed after offline discussion, thanks!
Test Results 24 files 24 suites 3d 22h 2m 27s ⏱️ For more details on these failures, see this check. Results for commit fdae629. ♻️ This comment has been updated with latest results. |
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.
This Pull request:
Changes or fixes:
In lazy mode, the
RDataLoaderfills its staging buffer with as many clusters as fit inbatch_size * batches_in_memoryentries, and loaded each of them with its ownChangeBeginAndEndEntriesand event loop. The clusters of a buffer that follow each other in the same dataframe are now merged into a single entry range before loading, so they are read in one event loop.This is particularly useful when shuffling is disabled because the clusters of a buffer always follow each other, so each buffer is loaded in a single event loop (instead of however many clusters it contained).
Ex.: 10 clusters of 100 entries (1000 entries total), read with
batch_size=100andbatches_in_memory=4, so a buffer holds 400 entries:An epoch goes from 10 event loops to 3 in this example. The rows are loaded in the same order, so the batches are unchanged.
Note
This might help when we decide to enable implicit multi-threading.
Checklist: