Improve performance of comparison transformations#1739
Merged
norberttech merged 2 commits into1.xfrom Jun 26, 2025
Merged
Conversation
Contributor
Flow PHP - BenchmarksResults of the benchmarks from this PR are compared with the results from 1.x branch. Extractors+-----------------------+------------------------+------+-----+-----------------+------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-----------------------+------------------------+------+-----+-----------------+------------------+-----------------+
| CSVExtractorBench | bench_extract_10k | 1 | 3 | 4.828mb +0.01% | 438.068ms +1.33% | ±3.38% +181.34% |
| ExcelExtractorBench | bench_extract_10k_ods | 1 | 3 | 65.539mb +0.00% | 1.067s -1.21% | ±0.82% -26.70% |
| ExcelExtractorBench | bench_extract_10k_xlsx | 1 | 3 | 67.585mb +0.00% | 1.697s -0.97% | ±0.52% -62.20% |
| JsonExtractorBench | bench_extract_10k | 1 | 3 | 5.436mb -0.00% | 1.168s +0.12% | ±0.33% -26.10% |
| ParquetExtractorBench | bench_extract_10k | 1 | 3 | 86.399mb -0.00% | 905.099ms -1.54% | ±0.42% +53.89% |
| TextExtractorBench | bench_extract_10k | 1 | 3 | 4.567mb +0.01% | 42.113ms +0.30% | ±0.57% -18.32% |
| XmlExtractorBench | bench_extract_10k | 1 | 3 | 4.552mb +0.01% | 602.401ms -2.48% | ±1.46% +555.66% |
+-----------------------+------------------------+------+-----+-----------------+------------------+-----------------+
Transformers+---------------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+---------------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| RenameEachEntryTransformerBench | bench_transform_10k_rows | 1 | 3 | 18.563mb +0.00% | 73.059ms -0.78% | ±0.85% -40.38% |
| RenameEntryTransformerBench | bench_transform_10k_rows | 1 | 3 | 123.301mb +0.00% | 68.129ms +2.56% | ±1.13% +18.26% |
+---------------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
Loaders+--------------------+----------------+------+-----+------------------+------------------+----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| CSVLoaderBench | bench_load_10k | 1 | 3 | 62.490mb +0.00% | 89.606ms +1.49% | ±1.10% +69.51% |
| JsonLoaderBench | bench_load_10k | 1 | 3 | 80.585mb +0.00% | 104.030ms +0.41% | ±0.16% -51.07% |
| ParquetLoaderBench | bench_load_10k | 1 | 3 | 166.298mb +0.00% | 2.017s -0.21% | ±0.40% -23.92% |
| TextLoaderBench | bench_load_10k | 1 | 3 | 17.869mb +0.00% | 31.353ms +0.20% | ±0.69% +49.39% |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
Building Blocks+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| benchmark | subject | revs | its | mem_peak | mode | rstdev |
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| TypeDetectorBench | bench_type_detector | 1 | 3 | 42.512mb +0.00% | 405.754ms +0.23% | ±0.40% -62.29% |
| TypeDetectorBench | bench_type_detector | 1 | 3 | 11.570mb +0.01% | 82.596ms +0.85% | ±1.20% +61.70% |
| EntryFactoryBench | bench_entry_factory | 1 | 3 | 105.982mb +0.00% | 652.418ms +0.11% | ±0.29% -51.90% |
| EntryFactoryBench | bench_entry_factory | 1 | 3 | 55.257mb +0.00% | 333.930ms +1.25% | ±0.81% +10.74% |
| EntryFactoryBench | bench_entry_factory | 1 | 3 | 14.843mb +0.01% | 70.216ms -0.13% | ±0.74% +225.18% |
| RowsBench | bench_chunk_10_on_10k | 2 | 3 | 93.453mb +0.00% | 3.953ms -2.86% | ±3.31% +9.95% |
| RowsBench | bench_diff_left_1k_on_10k | 2 | 3 | 110.823mb +0.00% | 240.381ms +1.02% | ±1.13% +37.37% |
| RowsBench | bench_diff_right_1k_on_10k | 2 | 3 | 93.543mb +0.00% | 24.369ms -0.54% | ±1.38% -14.63% |
| RowsBench | bench_drop_1k_on_10k | 2 | 3 | 94.328mb +0.00% | 1.709ms -13.58% | ±2.93% +152.66% |
| RowsBench | bench_drop_right_1k_on_10k | 2 | 3 | 94.328mb +0.00% | 1.710ms -5.87% | ±3.16% +31.75% |
| RowsBench | bench_entries_on_10k | 2 | 3 | 92.489mb +0.00% | 3.950ms +9.99% | ±1.84% +0.63% |
| RowsBench | bench_filter_on_10k | 2 | 3 | 93.018mb +0.00% | 15.872ms -5.24% | ±0.98% -19.95% |
| RowsBench | bench_find_on_10k | 2 | 3 | 93.018mb +0.00% | 16.001ms -3.93% | ±0.37% -85.18% |
| RowsBench | bench_find_one_on_10k | 10 | 3 | 91.707mb +0.00% | 1.994μs +5.28% | ±2.40% -5.08% |
| RowsBench | bench_first_on_10k | 10 | 3 | 91.707mb +0.00% | 0.400μs 0.00% | ±0.00% 0.00% |
| RowsBench | bench_flat_map_on_1k | 2 | 3 | 100.767mb +0.00% | 15.004ms -4.99% | ±0.30% -78.36% |
| RowsBench | bench_map_on_10k | 2 | 3 | 130.194mb +0.00% | 68.885ms +0.40% | ±1.38% +38.29% |
| RowsBench | bench_merge_1k_on_10k | 2 | 3 | 93.538mb +0.00% | 1.617ms -0.23% | ±3.66% +127.68% |
| RowsBench | bench_partition_by_on_10k | 2 | 3 | 96.907mb +0.00% | 64.033ms +1.26% | ±0.37% -60.89% |
| RowsBench | bench_remove_on_10k | 2 | 3 | 94.590mb +0.00% | 4.075ms +3.26% | ±1.73% +35.92% |
| RowsBench | bench_sort_asc_on_1k | 2 | 3 | 92.068mb +0.00% | 40.354ms -4.27% | ±1.85% -22.05% |
| RowsBench | bench_sort_by_on_1k | 2 | 3 | 92.069mb +0.00% | 40.568ms -1.59% | ±1.23% -19.50% |
| RowsBench | bench_sort_desc_on_1k | 2 | 3 | 92.068mb +0.00% | 40.922ms -2.69% | ±3.12% +58.12% |
| RowsBench | bench_sort_entries_on_1k | 2 | 3 | 94.150mb +0.00% | 8.809ms +4.43% | ±1.35% -33.26% |
| RowsBench | bench_sort_on_1k | 2 | 3 | 91.899mb +0.00% | 30.956ms -0.03% | ±1.34% -0.10% |
| RowsBench | bench_take_1k_on_10k | 10 | 3 | 91.707mb +0.00% | 15.142μs +2.86% | ±1.96% +130.79% |
| RowsBench | bench_take_right_1k_on_10k | 10 | 3 | 91.707mb +0.00% | 17.004μs -9.61% | ±2.34% +367.69% |
| RowsBench | bench_unique_on_1k | 2 | 3 | 110.824mb +0.00% | 243.445ms +1.06% | ±0.21% +63.98% |
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## 1.x #1739 +/- ##
==========================================
+ Coverage 81.23% 81.26% +0.03%
==========================================
Files 715 715
Lines 19873 19901 +28
==========================================
+ Hits 16143 16173 +30
+ Misses 3730 3728 -2
🚀 New features to boost your workflow:
|
stloyd
reviewed
Jun 26, 2025
| public function eval(Row $row) : bool | ||
| { | ||
| $left = (new Parameter($this->left))->eval($row); | ||
| $leftType = (new Parameter($this->left))->asType($row); |
Member
There was a problem hiding this comment.
If we get null as $left & $right should we still run version comparison?
Member
Author
There was a problem hiding this comment.
Not really, but it wont hurt, since the types comparator will get type_null 2x and will return that types are comparable.
Adding extra condition just for nulles doesn't seem to bring any significant performance boost (was just testing this locally)
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.
Resolves: #xxx
Change Log
Added
Fixed
Changed
Removed
Deprecated
Security