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

Performance optimizations #1221

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

norberttech
Copy link
Member

Change Log

Added

  • DataFrame::filters(array $filters) : self

Fixed

Changed

  • Optimized XPath Scalar Function by reusing DOMDocument instead of creating new one
  • Allow to pass Schema\Definition to withEntry in order to avoid using NativeEntryFactory type detection

Removed

Deprecated

Security


Description

Copy link
Contributor

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         |
+-----------------------+-------------------+------+-----+-----------------+------------------+----------------+
| CSVExtractorBench     | bench_extract_10k | 1    | 3   | 4.540mb +0.01%  | 511.328ms +0.43% | ±0.55% -49.95% |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.654mb +0.01%  | 1.064s -1.67%    | ±0.61% -53.12% |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 29.111mb +0.00% | 438.350ms +1.61% | ±0.59% -41.21% |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 4.297mb +0.01%  | 33.026ms -3.00%  | ±0.68% -16.13% |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 4.287mb +0.01%  | 748.139ms -1.67% | ±0.63% +44.39% |
+-----------------------+-------------------+------+-----+-----------------+------------------+----------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev         |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 116.573mb +0.00% | 59.695ms -1.73% | ±1.17% +74.10% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
Loaders
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode             | rstdev          |
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 54.738mb +0.00%  | 140.738ms +0.91% | ±1.35% +175.78% |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 90.347mb +0.00%  | 118.798ms -0.54% | ±1.01% -19.31%  |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 124.466mb +0.00% | 1.243s +1.25%    | ±0.49% -52.93%  |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 17.488mb +0.00%  | 44.244ms +0.33%  | ±0.27% -53.17%  |
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| benchmark               | subject                    | revs | its | mem_peak         | mode             | rstdev          |
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 107.416mb +0.00% | 477.830ms +0.36% | ±1.66% +645.51% |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 55.774mb +0.00%  | 236.085ms -0.41% | ±0.80% -56.35%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.612mb +0.00%  | 50.975ms -1.00%  | ±2.97% +241.71% |
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 87.329mb +0.00%  | 3.636ms +7.77%   | ±1.06% +26.03%  |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 102.933mb +0.00% | 184.922ms -2.41% | ±1.28% +35.23%  |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 85.653mb +0.00%  | 18.795ms -1.01%  | ±0.63% -68.96%  |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 88.569mb +0.00%  | 2.115ms +20.68%  | ±0.29% -14.16%  |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 88.569mb +0.00%  | 1.938ms +7.21%   | ±1.37% -7.98%   |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 85.681mb +0.00%  | 3.111ms +8.07%   | ±1.95% +271.22% |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 86.210mb +0.00%  | 16.908ms -0.87%  | ±0.55% +73.96%  |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 86.210mb +0.00%  | 16.966ms -3.39%  | ±1.31% +36.72%  |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 84.114mb +0.00%  | 1.706μs +0.72%   | ±2.72% -3.85%   |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 84.114mb +0.00%  | 0.400μs 0.00%    | ±0.00% 0.00%    |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 93.464mb +0.00%  | 13.013ms +3.03%  | ±0.27% -78.97%  |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 122.835mb +0.00% | 61.177ms -0.42%  | ±0.37% -59.39%  |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 86.730mb +0.00%  | 1.755ms +18.39%  | ±2.34% -5.84%   |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 90.086mb +0.00%  | 61.951ms +2.70%  | ±0.48% -60.74%  |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 88.831mb +0.00%  | 4.546ms +5.64%   | ±2.11% +51.48%  |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 84.264mb +0.00%  | 41.081ms -0.32%  | ±0.71% -28.20%  |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 84.264mb +0.00%  | 39.613ms +0.71%  | ±1.26% +56.78%  |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 84.264mb +0.00%  | 39.600ms -1.32%  | ±0.29% +41.60%  |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 86.555mb +0.00%  | 7.453ms +0.63%   | ±1.60% +365.20% |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 84.114mb +0.00%  | 29.046ms +0.02%  | ±1.62% +608.86% |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 84.114mb +0.00%  | 13.866μs +1.42%  | ±3.06% -10.76%  |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 84.114mb +0.00%  | 16.340μs +2.23%  | ±1.76% +31.38%  |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 102.934mb +0.00% | 190.850ms -0.44% | ±0.31% -63.29%  |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 53.219mb +0.00%  | 415.232ms +6.24% | ±3.26% -1.21%   |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 13.485mb +0.00%  | 80.278ms +0.67%  | ±2.34% +65.11%  |
+-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+

@norberttech norberttech merged commit 314f10c into flow-php:1.x Sep 13, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant