performance-test: suggest a more comparable loading time for non-eager and eager execution #1319
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.
Currently,
Load Time
reported in the performance test summary is the cumulative time spent inloader.load_data()
. This is good for all types of loaders.However, still within
Loader.load_data()
, immediately following the download of the dataset (from HF, for example, in case ofLoadHF
), comesMultiStream.from_iterables
, the first introduction of the downloaded data into unitxt's recipe. In this introduction, eager-execution differs in its action from non-eager-execution:In eager-mode, unitxt loops over each and every instance, to include it into the
ListStream
s constituting theMultiStream
being generated. Whereas in the non-eager mode, unitxt just creates generators, for theGeneratorStream
s constituting theMultiStream
generated in this case, and returns fromload_data()
.Now, with
load_iterables
recently introduced intoloaders.py
by @elronbandel , we can clearly fetch net load time of datasets, excluding the introduction of each and every instance into unitxt that is only done in eager mode.Here are demonstrating snakeviz-s:
For eager mode, more time is spent in
Loader.load_data()
than inLoaderHF.load_iterables
:Whereas for non-eager mode -- the same (the time to generate the generators is unnoticeable):