Skip to content

Conversation

@f-lapinski
Copy link
Contributor

@f-lapinski f-lapinski commented Feb 17, 2025

Change Log

Added

  • Added function StringBefore and Tests stringAfter($needle, $includingNeedle including needle is set false by default

Fixed

Changed

Removed

Deprecated

Security


Ref: #1316

Description

This function extracts the substring after a given delimiter, ensuring proper UTF-8

@github-actions
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.801mb +0.01%  | 552.121ms -0.28% | ±0.14% -90.91% |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.874mb +0.01%  | 1.060s -1.03%    | ±0.16% -72.38% |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 86.319mb +0.00% | 900.303ms -1.10% | ±0.27% +7.63%  |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 4.531mb +0.02%  | 35.487ms -1.04%  | ±0.64% -41.72% |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 4.505mb +0.02%  | 607.163ms +0.18% | ±1.23% +76.06% |
+-----------------------+-------------------+------+-----+-----------------+------------------+----------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev         |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 127.327mb +0.00% | 70.727ms -0.33% | ±1.03% -36.63% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
Loaders
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode             | rstdev          |
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 64.000mb +0.00%  | 103.316ms -3.04% | ±1.29% +38.97%  |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 84.347mb +0.00%  | 96.979ms -1.91%  | ±0.36% +67.94%  |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 161.190mb +0.00% | 20.538s -2.51%   | ±0.81% +823.62% |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 17.997mb +0.00%  | 31.337ms -0.39%  | ±0.76% -28.45%  |
+--------------------+----------------+------+-----+------------------+------------------+-----------------+
Building Blocks
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| benchmark         | subject                    | revs | its | mem_peak         | mode             | rstdev          |
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+
| EntryFactoryBench | bench_entry_factory        | 1    | 3   | 105.970mb +0.00% | 458.772ms -2.95% | ±0.40% -56.88%  |
| EntryFactoryBench | bench_entry_factory        | 1    | 3   | 55.161mb +0.00%  | 230.163ms -3.29% | ±0.41% -73.58%  |
| EntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.683mb +0.00%  | 50.332ms -1.66%  | ±1.13% +81.54%  |
| TypeDetectorBench | bench_type_detector        | 1    | 3   | 43.805mb +0.00%  | 358.528ms -2.56% | ±2.49% +229.12% |
| TypeDetectorBench | bench_type_detector        | 1    | 3   | 11.615mb +0.01%  | 72.791ms -0.74%  | ±0.55% +15.18%  |
| RowsBench         | bench_chunk_10_on_10k      | 2    | 3   | 97.014mb +0.00%  | 3.188ms -20.62%  | ±0.59% -74.86%  |
| RowsBench         | bench_diff_left_1k_on_10k  | 2    | 3   | 114.299mb +0.00% | 187.808ms +0.62% | ±0.53% -59.55%  |
| RowsBench         | bench_diff_right_1k_on_10k | 2    | 3   | 97.019mb +0.00%  | 18.925ms -0.63%  | ±1.10% -27.50%  |
| RowsBench         | bench_drop_1k_on_10k       | 2    | 3   | 97.888mb +0.00%  | 1.418ms -33.43%  | ±0.53% -72.23%  |
| RowsBench         | bench_drop_right_1k_on_10k | 2    | 3   | 97.888mb +0.00%  | 1.625ms -27.48%  | ±3.16% +154.38% |
| RowsBench         | bench_entries_on_10k       | 2    | 3   | 96.049mb +0.00%  | 4.746ms -22.09%  | ±3.44% +3.25%   |
| RowsBench         | bench_filter_on_10k        | 2    | 3   | 96.578mb +0.00%  | 16.841ms -2.08%  | ±1.36% +129.03% |
| RowsBench         | bench_find_on_10k          | 2    | 3   | 96.578mb +0.00%  | 16.642ms -3.15%  | ±1.31% +130.05% |
| RowsBench         | bench_find_one_on_10k      | 10   | 3   | 95.269mb +0.00%  | 1.906μs -4.41%   | ±2.44% +1.72%   |
| RowsBench         | bench_first_on_10k         | 10   | 3   | 95.269mb +0.00%  | 0.300μs -40.00%  | ±0.00% 0.00%    |
| RowsBench         | bench_flat_map_on_1k       | 2    | 3   | 104.487mb +0.00% | 14.552ms -9.52%  | ±2.74% +463.36% |
| RowsBench         | bench_map_on_10k           | 2    | 3   | 134.555mb +0.00% | 70.955ms -4.90%  | ±0.40% -60.12%  |
| RowsBench         | bench_merge_1k_on_10k      | 2    | 3   | 97.098mb +0.00%  | 1.264ms -38.63%  | ±0.94% -69.73%  |
| RowsBench         | bench_partition_by_on_10k  | 2    | 3   | 100.399mb +0.00% | 65.236ms -2.31%  | ±1.78% -1.39%   |
| RowsBench         | bench_remove_on_10k        | 2    | 3   | 98.150mb +0.00%  | 3.869ms -13.95%  | ±2.40% +56.15%  |
| RowsBench         | bench_sort_asc_on_1k       | 2    | 3   | 95.561mb +0.00%  | 42.866ms -2.30%  | ±0.68% +29.04%  |
| RowsBench         | bench_sort_by_on_1k        | 2    | 3   | 95.561mb +0.00%  | 42.617ms -2.28%  | ±1.51% -8.63%   |
| RowsBench         | bench_sort_desc_on_1k      | 2    | 3   | 95.561mb +0.00%  | 42.749ms -1.52%  | ±0.46% +6.50%   |
| RowsBench         | bench_sort_entries_on_1k   | 2    | 3   | 97.710mb +0.00%  | 8.199ms -4.45%   | ±0.88% +10.81%  |
| RowsBench         | bench_sort_on_1k           | 2    | 3   | 95.460mb +0.00%  | 29.642ms -1.84%  | ±1.63% +313.50% |
| RowsBench         | bench_take_1k_on_10k       | 10   | 3   | 95.269mb +0.00%  | 12.993μs -11.65% | ±2.35% +633.77% |
| RowsBench         | bench_take_right_1k_on_10k | 10   | 3   | 95.269mb +0.00%  | 15.300μs -20.64% | ±0.53% -17.28%  |
| RowsBench         | bench_unique_on_1k         | 2    | 3   | 114.300mb +0.00% | 186.910ms -1.81% | ±0.46% +208.52% |
+-------------------+----------------------------+------+-----+------------------+------------------+-----------------+

@codecov
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.08%. Comparing base (2b3e452) to head (21a3a4d).
Report is 3 commits behind head on 1.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              1.x    #1485      +/-   ##
==========================================
- Coverage   83.08%   83.08%   -0.01%     
==========================================
  Files         666      667       +1     
  Lines       17899    17912      +13     
==========================================
+ Hits        14872    14882      +10     
- Misses       3027     3030       +3     
Components Coverage Δ
etl 85.82% <76.92%> (-0.02%) ⬇️
cli 86.73% <ø> (ø)
lib-array-dot 94.53% <ø> (ø)
lib-azure-sdk 62.56% <ø> (ø)
lib-doctrine-dbal-bulk 97.43% <ø> (ø)
lib-filesystem 76.75% <ø> (ø)
lib-parquet 84.33% <ø> (ø)
lib-parquet-viewer 82.02% <ø> (ø)
lib-rdsl 87.09% <ø> (ø)
lib-snappy 91.16% <ø> (ø)
bridge-filesystem-async-aws 90.38% <ø> (ø)
bridge-filesystem-azure 89.92% <ø> (ø)
bridge-monolog-http 96.38% <ø> (ø)
symfony-http-foundation 77.10% <ø> (ø)
adapter-chartjs 86.45% <ø> (ø)
adapter-csv 89.57% <ø> (ø)
adapter-doctrine 88.68% <ø> (ø)
adapter-elasticsearch 97.19% <ø> (ø)
adapter-google-sheet 78.04% <ø> (ø)
adapter-http 59.15% <ø> (ø)
adapter-json 90.62% <ø> (ø)
adapter-logger 53.84% <ø> (ø)
adapter-meilisearch 97.75% <ø> (ø)
adapter-parquet 80.85% <ø> (ø)
adapter-text 84.44% <ø> (ø)
adapter-xml 83.15% <ø> (ø)

@norberttech norberttech merged commit 0899a27 into flow-php:1.x Feb 18, 2025
24 of 25 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.

2 participants