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

Json Loader - allow to write each node in a new line #1183

Conversation

norberttech
Copy link
Member

Change Log

Added

  • JsonLoader parameter that defines if each row should be a single line in the output file
  • JsonLoader int $flags parameter that is passed later to internal json_encode function

Fixed

Changed

Removed

Deprecated

Security


Description

Resolves: #1180

Copy link
Contributor

github-actions bot commented Aug 9, 2024

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   | 3.951mb +0.02%  | 515.392ms +0.38% | ±0.54% +3.70%   |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.083mb +0.02%  | 1.063s +0.11%    | ±0.36% -27.71%  |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 28.546mb +0.00% | 427.897ms -1.30% | ±0.84% +106.38% |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 3.711mb +0.02%  | 34.406ms +1.01%  | ±1.46% +15.40%  |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 3.700mb +0.02%  | 774.184ms +1.98% | ±2.99% +159.79% |
+-----------------------+-------------------+------+-----+-----------------+------------------+-----------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev         |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 116.052mb +0.00% | 59.311ms -2.73% | ±0.38% +19.35% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
Loaders
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode             | rstdev         |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 54.212mb +0.00%  | 137.950ms -1.75% | ±0.73% -60.79% |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 89.823mb +0.00%  | 116.658ms +0.26% | ±0.87% -45.76% |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 123.824mb +0.00% | 1.216s -2.22%    | ±0.62% +17.94% |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 16.967mb +0.00%  | 44.145ms -0.80%  | ±0.44% +28.95% |
+--------------------+----------------+------+-----+------------------+------------------+----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+------------------+------------------+------------------+
| benchmark               | subject                    | revs | its | mem_peak         | mode             | rstdev           |
+-------------------------+----------------------------+------+-----+------------------+------------------+------------------+
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 52.633mb +0.00%  | 417.486ms +6.22% | ±0.52% -81.55%   |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 12.899mb +0.01%  | 78.417ms -0.54%  | ±1.50% +329.11%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 106.825mb +0.00% | 469.180ms +1.23% | ±0.92% +25.67%   |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 55.184mb +0.00%  | 234.085ms -1.78% | ±0.75% -10.08%   |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.022mb +0.00%  | 51.019ms -3.04%  | ±1.39% +1127.98% |
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 86.808mb +0.00%  | 3.206ms -17.57%  | ±1.23% -64.30%   |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 102.412mb +0.00% | 189.751ms +0.65% | ±0.69% +20.69%   |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 85.132mb +0.00%  | 18.709ms -3.22%  | ±0.90% +54.10%   |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 88.048mb +0.00%  | 1.718ms -2.75%   | ±0.36% -74.82%   |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 88.048mb +0.00%  | 1.726ms -6.17%   | ±0.40% -87.97%   |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 85.161mb +0.00%  | 2.539ms -12.51%  | ±0.79% -16.84%   |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 85.689mb +0.00%  | 15.863ms -5.29%  | ±1.27% +44.71%   |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 85.689mb +0.00%  | 15.758ms -5.67%  | ±0.35% -25.35%   |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 83.593mb +0.00%  | 1.606μs -15.74%  | ±2.89% +18.37%   |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 83.593mb +0.00%  | 0.400μs 0.00%    | ±0.00% 0.00%     |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 92.944mb +0.00%  | 12.111ms -10.15% | ±0.45% -63.64%   |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 122.314mb +0.00% | 60.273ms -2.53%  | ±0.62% -7.18%    |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 86.209mb +0.00%  | 1.241ms -22.07%  | ±0.94% -35.20%   |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 89.561mb +0.00%  | 65.078ms -0.62%  | ±1.98% +77.62%   |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 88.311mb +0.00%  | 4.138ms +1.22%   | ±1.25% +76.57%   |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 83.743mb +0.00%  | 39.019ms -6.56%  | ±0.57% -81.32%   |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 83.743mb +0.00%  | 39.185ms -3.62%  | ±3.03% -6.17%    |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 83.743mb +0.00%  | 39.050ms -6.53%  | ±0.70% -45.54%   |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 86.035mb +0.00%  | 7.537ms -2.96%   | ±1.05% -42.74%   |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 83.593mb +0.00%  | 28.775ms -3.35%  | ±0.81% -33.25%   |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 83.593mb +0.00%  | 13.824μs -1.17%  | ±1.35% +100.00%  |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 83.593mb +0.00%  | 16.394μs -1.24%  | ±0.29% -41.44%   |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 102.413mb +0.00% | 192.006ms +0.08% | ±0.82% +103.82%  |
+-------------------------+----------------------------+------+-----+------------------+------------------+------------------+

@norberttech norberttech merged commit 0a17f83 into flow-php:1.x Aug 9, 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.

Json Loader - write each row in new line
1 participant