Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataFrame - batch size #720

Merged
merged 2 commits into from
Nov 3, 2023
Merged

Conversation

norberttech
Copy link
Member

Change Log

Added

  • DataFrame::batchSize(int $size) method

Fixed

Changed

Removed

Deprecated

  • DataFrame::parallelize()

Security


Description

Instead of using DataFrame::parallelize which was only splitting rows, from now DataFrame::batchSize should be used that is more generic and can not only split but also merge rows together when smaller batches are yielded from Extractors.

Copy link
Contributor

github-actions bot commented Nov 3, 2023

Flow PHP - Benchmarks

Results of the benchmarks from this PR are compared with the results from 1.x branch.

Extractors
+-----------------------+-------------------+------+-----+------------------+-------------------+-----------------+
| benchmark             | subject           | revs | its | mem_peak         | mode              | rstdev          |
+-----------------------+-------------------+------+-----+------------------+-------------------+-----------------+
| AvroExtractorBench    | bench_extract_10k | 1    | 3   | 44.093mb +0.00%  | 536.479ms +51.95% | ±2.41% +149.80% |
| CSVExtractorBench     | bench_extract_10k | 1    | 3   | 13.977mb +0.01%  | 460.229ms +74.07% | ±1.54% +146.31% |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 18.639mb +0.00%  | 820.729ms +45.05% | ±1.50% +2.17%   |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 242.975mb +0.00% | 1.253s +66.27%    | ±2.74% +574.20% |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 7.247mb +0.01%   | 21.429ms +42.40%  | ±2.93% +91.22%  |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 7.594mb +0.01%   | 742.675ms +65.29% | ±3.32% +415.57% |
+-----------------------+-------------------+------+-----+------------------+-------------------+-----------------+
Transformers
+-----------------------------+--------------------------+------+-----+-----------------+------------------+-----------------+
| benchmark                   | subject                  | revs | its | mem_peak        | mode             | rstdev          |
+-----------------------------+--------------------------+------+-----+-----------------+------------------+-----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 87.032mb +0.00% | 86.384ms +77.94% | ±3.16% +550.12% |
+-----------------------------+--------------------------+------+-----+-----------------+------------------+-----------------+
Loaders
+--------------------+----------------+------+-----+------------------+-------------------+-----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode              | rstdev          |
+--------------------+----------------+------+-----+------------------+-------------------+-----------------+
| AvroLoaderBench    | bench_load_10k | 1    | 3   | 93.197mb +0.00%  | 915.910ms +60.75% | ±2.96% +80.09%  |
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 47.111mb +0.00%  | 94.022ms +37.59%  | ±0.40% -75.13%  |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 88.545mb +0.00%  | 90.474ms +59.05%  | ±2.62% +234.16% |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 286.875mb +0.00% | 1.887s +58.33%    | ±3.59% +624.92% |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 16.532mb +0.00%  | 41.529ms +0.55%   | ±2.15% +25.06%  |
+--------------------+----------------+------+-----+------------------+-------------------+-----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+-----------------+-------------------+------------------+
| benchmark               | subject                    | revs | its | mem_peak        | mode              | rstdev           |
+-------------------------+----------------------------+------+-----+-----------------+-------------------+------------------+
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 60.656mb +0.00% | 5.154ms +107.58%  | ±2.40% +49.57%   |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 80.449mb +0.00% | 207.289ms +37.53% | ±2.49% +159.95%  |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 58.974mb +0.00% | 20.196ms +31.11%  | ±3.39% +60.22%   |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 59.795mb +0.00% | 3.878ms +120.84%  | ±2.89% +354.11%  |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 59.795mb +0.00% | 3.416ms +89.34%   | ±2.05% +27.58%   |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 59.008mb +0.00% | 4.118ms +52.47%   | ±1.27% +6.65%    |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 59.537mb +0.00% | 24.182ms +68.17%  | ±3.81% +431.50%  |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 59.537mb +0.00% | 25.259ms +77.47%  | ±1.84% +286.52%  |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 57.608mb +0.00% | 2.300μs +27.77%   | ±3.55% +0.00%    |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 57.608mb +0.00% | 0.500μs +25.00%   | ±0.00% -100.00%  |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 65.842mb +0.00% | 16.865ms +65.20%  | ±2.26% -13.65%   |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 91.361mb +0.00% | 83.518ms +75.42%  | ±1.58% +21.09%   |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 60.058mb +0.00% | 3.753ms +88.07%   | ±1.59% -45.65%   |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 62.328mb +0.00% | 54.142ms +60.23%  | ±3.46% +355.54%  |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 62.158mb +0.00% | 8.978ms +87.49%   | ±1.47% +370.47%  |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 57.608mb +0.00% | 60.285ms +57.88%  | ±2.15% +231.86%  |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 57.608mb +0.00% | 57.071ms +54.15%  | ±3.48% +590.21%  |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 57.608mb +0.00% | 55.314ms +43.87%  | ±2.34% +2201.34% |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 59.883mb +0.00% | 10.962ms +50.13%  | ±2.88% +594.18%  |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 57.608mb +0.00% | 43.181ms +52.76%  | ±1.52% +274.53%  |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 57.608mb +0.00% | 31.659μs +146.76% | ±2.31% +27.10%   |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 57.608mb +0.00% | 35.296μs +127.41% | ±3.48% +331.08%  |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 80.449mb +0.00% | 208.053ms +33.50% | ±1.83% +373.81%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 91.746mb -0.03% | 176.099ms +41.46% | ±3.19% +6.08%    |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 47.603mb -0.01% | 99.173ms +68.41%  | ±0.60% +17.52%   |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 12.384mb -0.00% | 21.652ms +58.12%  | ±3.38% +164.40%  |
+-------------------------+----------------------------+------+-----+-----------------+-------------------+------------------+

@norberttech norberttech merged commit 85e3db4 into flow-php:1.x Nov 3, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants