Skip to content

Conversation

@norberttech
Copy link
Member

@norberttech norberttech commented Aug 4, 2024

Change Log

Added

  • XML Loader - writing to XML files

Fixed

Changed

Removed

Deprecated

Security


Description

This pull request is a continuation of #1151

Closes: #1151
Closes: #734

Whole reasoning behind this PR was described on Discord

Example:

df()
    ->read(from_array([
        ['_id' => 1, 'name' => 'John', 'address' => ['_id' => 1, 'city' => 'New York', 'street' => '5th Avenue']],
        ['_id' => 2, 'name' => 'Jane', 'address' => ['_id' => 2, 'city' => 'Los Angeles', 'street' => 'Hollywood Boulevard']],
    ]))
    ->write(to_xml($path = $this->cacheDir->suffix('test_xml_loader.xml')))
    ->run();

Output:

<?xml version="1.0" encoding="UTF-8"?>
<rows>
    <row id="1"><name>John</name><address id="1"><city>New York</city><street>5th Avenue</street></address></row>
    <row id="2"><name>Jane</name><address id="2"><city>Los Angeles</city><street>Hollywood Boulevard</street></address></row>
</rows>

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 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.954mb +0.19%  | 508.534ms -0.44% | ±0.06% -93.03% |
| JsonExtractorBench    | bench_extract_10k | 1    | 3   | 4.087mb +0.18%  | 1.067s -0.69%    | ±0.40% +18.09% |
| ParquetExtractorBench | bench_extract_10k | 1    | 3   | 28.546mb +0.03% | 426.753ms -0.11% | ±0.76% -67.64% |
| TextExtractorBench    | bench_extract_10k | 1    | 3   | 3.714mb +0.20%  | 33.367ms -0.55%  | ±0.76% -46.95% |
| XmlExtractorBench     | bench_extract_10k | 1    | 3   | 3.660mb +0.21%  | 431.484ms -1.20% | ±0.47% +77.58% |
+-----------------------+-------------------+------+-----+-----------------+------------------+----------------+
Transformers
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| benchmark                   | subject                  | revs | its | mem_peak         | mode            | rstdev         |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
| RenameEntryTransformerBench | bench_transform_10k_rows | 1    | 3   | 116.055mb +0.01% | 60.049ms +2.37% | ±0.46% -60.20% |
+-----------------------------+--------------------------+------+-----+------------------+-----------------+----------------+
Loaders
+--------------------+----------------+------+-----+------------------+-----------------+-----------------+
| benchmark          | subject        | revs | its | mem_peak         | mode            | rstdev          |
+--------------------+----------------+------+-----+------------------+-----------------+-----------------+
| CSVLoaderBench     | bench_load_10k | 1    | 3   | 54.176mb +0.01%  | 84.458ms +2.29% | ±0.59% -12.92%  |
| JsonLoaderBench    | bench_load_10k | 1    | 3   | 102.498mb +0.01% | 52.785ms +2.61% | ±0.43% -39.47%  |
| ParquetLoaderBench | bench_load_10k | 1    | 3   | 123.825mb +0.01% | 1.220s -0.09%   | ±0.35% +342.19% |
| TextLoaderBench    | bench_load_10k | 1    | 3   | 16.970mb +0.04%  | 44.388ms +3.46% | ±0.54% +159.57% |
+--------------------+----------------+------+-----+------------------+-----------------+-----------------+
Building Blocks
+-------------------------+----------------------------+------+-----+------------------+------------------+------------------+
| benchmark               | subject                    | revs | its | mem_peak         | mode             | rstdev           |
+-------------------------+----------------------------+------+-----+------------------+------------------+------------------+
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 52.638mb +0.01%  | 414.903ms +8.00% | ±3.37% +1304.89% |
| TypeDetectorBench       | bench_type_detector        | 1    | 3   | 12.904mb +0.06%  | 83.839ms +8.03%  | ±0.48% -64.75%   |
| RowsBench               | bench_chunk_10_on_10k      | 2    | 3   | 86.812mb +0.01%  | 3.134ms -0.66%   | ±2.78% +348.12%  |
| RowsBench               | bench_diff_left_1k_on_10k  | 2    | 3   | 102.413mb +0.01% | 190.812ms +0.82% | ±0.30% -70.84%   |
| RowsBench               | bench_diff_right_1k_on_10k | 2    | 3   | 85.133mb +0.01%  | 19.306ms +3.18%  | ±1.39% +631.59%  |
| RowsBench               | bench_drop_1k_on_10k       | 2    | 3   | 88.052mb +0.01%  | 1.688ms +3.32%   | ±3.07% +199.52%  |
| RowsBench               | bench_drop_right_1k_on_10k | 2    | 3   | 88.052mb +0.01%  | 1.686ms +3.34%   | ±0.47% -56.62%   |
| RowsBench               | bench_entries_on_10k       | 2    | 3   | 85.164mb +0.01%  | 2.650ms +8.60%   | ±1.49% +74.52%   |
| RowsBench               | bench_filter_on_10k        | 2    | 3   | 85.693mb +0.01%  | 16.144ms +10.95% | ±0.92% -44.28%   |
| RowsBench               | bench_find_on_10k          | 2    | 3   | 85.693mb +0.01%  | 16.006ms +10.38% | ±1.87% +135.64%  |
| RowsBench               | bench_find_one_on_10k      | 10   | 3   | 83.596mb +0.01%  | 1.694μs +5.47%   | ±2.83% -2.00%    |
| RowsBench               | bench_first_on_10k         | 10   | 3   | 83.596mb +0.01%  | 0.300μs -25.00%  | ±0.00% -100.00%  |
| RowsBench               | bench_flat_map_on_1k       | 2    | 3   | 92.947mb +0.01%  | 12.243ms +1.68%  | ±2.03% +2166.38% |
| RowsBench               | bench_map_on_10k           | 2    | 3   | 122.317mb +0.01% | 60.605ms +0.79%  | ±0.90% -20.35%   |
| RowsBench               | bench_merge_1k_on_10k      | 2    | 3   | 86.212mb +0.01%  | 1.263ms +5.99%   | ±1.81% -3.27%    |
| RowsBench               | bench_partition_by_on_10k  | 2    | 3   | 89.561mb +0.01%  | 58.522ms -3.80%  | ±0.63% -37.78%   |
| RowsBench               | bench_remove_on_10k        | 2    | 3   | 88.314mb +0.01%  | 3.846ms +1.69%   | ±1.13% +3873.00% |
| RowsBench               | bench_sort_asc_on_1k       | 2    | 3   | 83.743mb +0.01%  | 39.167ms -0.32%  | ±1.09% +20.86%   |
| RowsBench               | bench_sort_by_on_1k        | 2    | 3   | 83.744mb +0.01%  | 39.553ms +0.70%  | ±3.06% +305.54%  |
| RowsBench               | bench_sort_desc_on_1k      | 2    | 3   | 83.743mb +0.01%  | 40.016ms +1.78%  | ±0.42% -72.33%   |
| RowsBench               | bench_sort_entries_on_1k   | 2    | 3   | 86.038mb +0.01%  | 7.292ms -0.04%   | ±0.81% +33.14%   |
| RowsBench               | bench_sort_on_1k           | 2    | 3   | 83.596mb +0.01%  | 29.213ms +1.46%  | ±1.42% +140.01%  |
| RowsBench               | bench_take_1k_on_10k       | 10   | 3   | 83.596mb +0.01%  | 13.288μs +0.09%  | ±1.95% +36.43%   |
| RowsBench               | bench_take_right_1k_on_10k | 10   | 3   | 83.596mb +0.01%  | 15.794μs -0.17%  | ±0.30% -62.20%   |
| RowsBench               | bench_unique_on_1k         | 2    | 3   | 102.414mb +0.01% | 194.974ms +0.67% | ±1.77% +121.03%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 106.828mb +0.01% | 466.438ms -0.73% | ±2.44% +176.69%  |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 55.187mb +0.01%  | 235.573ms +0.45% | ±0.37% -48.58%   |
| NativeEntryFactoryBench | bench_entry_factory        | 1    | 3   | 14.025mb +0.05%  | 53.753ms +5.38%  | ±2.75% +6.24%    |
+-------------------------+----------------------------+------+-----+------------------+------------------+------------------+

@norberttech norberttech merged commit 8d05d10 into flow-php:1.x Aug 4, 2024
@norberttech norberttech deleted the xml-write branch December 5, 2024 20:19
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.

XML Writer

2 participants