flow-php / flow

Flow PHP - data processing framework
https://flow-php.com
MIT License
472 stars 26 forks source link

chore: Replace `uniqid` with guarantee uniqueness #1102

Closed stloyd closed 3 months ago

stloyd commented 3 months ago

Change Log

Added

Fixed

Changed

  • Replace `uniqid` with guarantee uniqueness

Removed

Deprecated

Security


Description

Reason is upcoming deprecation and that uniqid is not so unique in the end: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_uniqid

github-actions[bot] commented 3 months ago

Flow PHP - Benchmarks

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

Extractors ```shell +-----------------------+-------------------+------+-----+------------------+------------------+-----------------+ | benchmark | subject | revs | its | mem_peak | mode | rstdev | +-----------------------+-------------------+------+-----+------------------+------------------+-----------------+ | CSVExtractorBench | bench_extract_10k | 1 | 3 | 5.175mb -0.08% | 337.627ms +0.49% | ±0.34% +144.86% | | JsonExtractorBench | bench_extract_10k | 1 | 3 | 5.208mb -0.08% | 1.076s +0.79% | ±0.27% -88.12% | | ParquetExtractorBench | bench_extract_10k | 1 | 3 | 135.881mb -0.00% | 747.021ms -0.89% | ±0.71% -58.89% | | TextExtractorBench | bench_extract_10k | 1 | 3 | 4.965mb -0.08% | 36.961ms +3.03% | ±3.68% +473.05% | | XmlExtractorBench | bench_extract_10k | 1 | 3 | 4.971mb -0.08% | 437.705ms +1.01% | ±1.26% +94.06% | +-----------------------+-------------------+------+-----+------------------+------------------+-----------------+ ```
Transformers ```shell +-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+ | benchmark | subject | revs | its | mem_peak | mode | rstdev | +-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+ | RenameEntryTransformerBench | bench_transform_10k_rows | 1 | 3 | 116.272mb -0.00% | 59.916ms +0.72% | ±1.45% +9.99% | +-----------------------------+--------------------------+------+-----+------------------+-----------------+---------------+ ```
Loaders ```shell +--------------------+----------------+------+-----+------------------+-----------------+-----------------+ | benchmark | subject | revs | its | mem_peak | mode | rstdev | +--------------------+----------------+------+-----+------------------+-----------------+-----------------+ | CSVLoaderBench | bench_load_10k | 1 | 3 | 55.254mb -0.01% | 69.947ms +3.05% | ±0.25% -21.29% | | JsonLoaderBench | bench_load_10k | 1 | 3 | 107.628mb -0.00% | 51.531ms +0.36% | ±0.88% +41.25% | | ParquetLoaderBench | bench_load_10k | 1 | 3 | 227.051mb -0.00% | 1.409s +0.25% | ±0.54% +117.66% | | TextLoaderBench | bench_load_10k | 1 | 3 | 18.009mb -0.02% | 39.248ms +0.95% | ±0.65% +139.41% | +--------------------+----------------+------+-----+------------------+-----------------+-----------------+ ```
Building Blocks ```shell +-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+ | benchmark | subject | revs | its | mem_peak | mode | rstdev | +-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+ | NativeEntryFactoryBench | bench_entry_factory | 1 | 3 | 116.821mb -0.00% | 501.685ms -1.14% | ±1.32% -46.93% | | NativeEntryFactoryBench | bench_entry_factory | 1 | 3 | 60.299mb -0.01% | 254.085ms +0.81% | ±1.54% +28.69% | | NativeEntryFactoryBench | bench_entry_factory | 1 | 3 | 15.233mb -0.03% | 52.868ms -2.59% | ±1.45% -20.66% | | TypeDetectorBench | bench_type_detector | 1 | 3 | 60.000mb -0.01% | 435.140ms +0.69% | ±0.44% -34.03% | | TypeDetectorBench | bench_type_detector | 1 | 3 | 14.539mb -0.03% | 86.536ms -0.29% | ±0.82% +119.76% | | RowsBench | bench_chunk_10_on_10k | 2 | 3 | 87.091mb -0.00% | 3.470ms -4.06% | ±1.62% -45.07% | | RowsBench | bench_diff_left_1k_on_10k | 2 | 3 | 102.689mb -0.00% | 182.966ms -2.29% | ±0.35% -57.32% | | RowsBench | bench_diff_right_1k_on_10k | 2 | 3 | 85.409mb -0.00% | 18.534ms -2.20% | ±0.91% -11.98% | | RowsBench | bench_drop_1k_on_10k | 2 | 3 | 88.331mb -0.00% | 1.907ms +0.82% | ±2.14% -21.02% | | RowsBench | bench_drop_right_1k_on_10k | 2 | 3 | 88.331mb -0.00% | 1.781ms -11.01% | ±1.93% -17.40% | | RowsBench | bench_entries_on_10k | 2 | 3 | 85.443mb -0.00% | 2.845ms -7.22% | ±1.81% -29.75% | | RowsBench | bench_filter_on_10k | 2 | 3 | 85.972mb -0.00% | 16.532ms +0.94% | ±0.71% -54.40% | | RowsBench | bench_find_on_10k | 2 | 3 | 85.972mb -0.00% | 16.637ms -2.94% | ±1.21% +2.80% | | RowsBench | bench_find_one_on_10k | 10 | 3 | 83.876mb -0.00% | 1.694μs -5.57% | ±2.83% +6.00% | | RowsBench | bench_first_on_10k | 10 | 3 | 83.876mb -0.00% | 0.400μs +33.33% | ±0.00% +0.00% | | RowsBench | bench_flat_map_on_1k | 2 | 3 | 93.226mb -0.00% | 12.435ms +0.89% | ±0.29% -47.07% | | RowsBench | bench_map_on_10k | 2 | 3 | 122.597mb -0.00% | 61.190ms -0.87% | ±0.67% +28.54% | | RowsBench | bench_merge_1k_on_10k | 2 | 3 | 86.492mb -0.00% | 1.302ms -17.61% | ±2.93% -15.00% | | RowsBench | bench_partition_by_on_10k | 2 | 3 | 89.838mb -0.00% | 63.866ms -1.25% | ±0.78% -6.79% | | RowsBench | bench_remove_on_10k | 2 | 3 | 88.593mb -0.00% | 4.130ms -5.92% | ±2.23% +18.33% | | RowsBench | bench_sort_asc_on_1k | 2 | 3 | 84.019mb -0.00% | 39.323ms -1.82% | ±1.02% +24.69% | | RowsBench | bench_sort_by_on_1k | 2 | 3 | 84.020mb -0.00% | 39.138ms -2.95% | ±0.02% -96.81% | | RowsBench | bench_sort_desc_on_1k | 2 | 3 | 84.019mb -0.00% | 39.567ms -1.26% | ±1.88% -34.99% | | RowsBench | bench_sort_entries_on_1k | 2 | 3 | 86.317mb -0.00% | 7.304ms -1.36% | ±0.67% +7.44% | | RowsBench | bench_sort_on_1k | 2 | 3 | 83.876mb -0.00% | 28.478ms -1.93% | ±0.45% -66.12% | | RowsBench | bench_take_1k_on_10k | 10 | 3 | 83.876mb -0.00% | 13.634μs +0.29% | ±1.51% +335.89% | | RowsBench | bench_take_right_1k_on_10k | 10 | 3 | 83.876mb -0.00% | 15.893μs -3.16% | ±1.92% +236.03% | | RowsBench | bench_unique_on_1k | 2 | 3 | 102.690mb -0.00% | 187.990ms -2.34% | ±0.23% -87.27% | +-------------------------+----------------------------+------+-----+------------------+------------------+-----------------+ ```
norberttech commented 3 months ago

very nice, I was about to create an issue after reading a discussion at Roave discord 👍