From 0ec4a268f357d70e046fdc5998971aa690e5fbed Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Mon, 16 Oct 2023 20:24:56 +0200 Subject: [PATCH] Replaced iterator_to_array with foreach in benchmarks --- .../ETL/Adapter/Avro/Tests/Benchmark/AvroExtractorBench.php | 3 ++- .../Flow/ETL/Adapter/CSV/Tests/Benchmark/CSVExtractorBench.php | 3 ++- .../ETL/Adapter/JSON/Tests/Benchmark/JsonExtractorBench.php | 3 ++- .../Adapter/Parquet/Tests/Benchmark/ParquetExtractorBench.php | 3 ++- .../ETL/Adapter/Text/Tests/Benchmark/TextExtractorBench.php | 3 ++- .../Flow/ETL/Adapter/XML/Tests/Benchmark/XmlExtractorBench.php | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Benchmark/AvroExtractorBench.php b/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Benchmark/AvroExtractorBench.php index 40988ed02..0af8bc140 100644 --- a/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Benchmark/AvroExtractorBench.php +++ b/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Benchmark/AvroExtractorBench.php @@ -16,6 +16,7 @@ final class AvroExtractorBench #[Revs(5)] public function bench_extract_10k() : void { - \iterator_to_array(Avro::from(__DIR__ . '/../Fixtures/orders_flow.avro')->extract(new FlowContext(Config::default()))); + foreach (Avro::from(__DIR__ . '/../Fixtures/orders_flow.avro')->extract(new FlowContext(Config::default())) as $rows) { + } } } diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Benchmark/CSVExtractorBench.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Benchmark/CSVExtractorBench.php index e2ea61a97..73072701f 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Benchmark/CSVExtractorBench.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Benchmark/CSVExtractorBench.php @@ -16,6 +16,7 @@ final class CSVExtractorBench #[Revs(5)] public function bench_extract_10k() : void { - \iterator_to_array(CSV::from(__DIR__ . '/../Fixtures/orders_flow.csv')->extract(new FlowContext(Config::default()))); + foreach (CSV::from(__DIR__ . '/../Fixtures/orders_flow.csv')->extract(new FlowContext(Config::default())) as $rows) { + } } } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Benchmark/JsonExtractorBench.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Benchmark/JsonExtractorBench.php index c8cc3f760..bc4d1f7ae 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Benchmark/JsonExtractorBench.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Benchmark/JsonExtractorBench.php @@ -16,6 +16,7 @@ final class JsonExtractorBench #[Revs(5)] public function bench_extract_10k() : void { - \iterator_to_array(Json::from(__DIR__ . '/../Fixtures/orders_flow.json')->extract(new FlowContext(Config::default()))); + foreach (Json::from(__DIR__ . '/../Fixtures/orders_flow.json')->extract(new FlowContext(Config::default())) as $rows) { + } } } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Benchmark/ParquetExtractorBench.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Benchmark/ParquetExtractorBench.php index 73dd4cd29..82f375ee4 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Benchmark/ParquetExtractorBench.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Benchmark/ParquetExtractorBench.php @@ -16,6 +16,7 @@ final class ParquetExtractorBench #[Revs(5)] public function bench_extract_10k() : void { - \iterator_to_array(Parquet::from(__DIR__ . '/../Fixtures/orders_flow.parquet')->extract(new FlowContext(Config::default()))); + foreach (Parquet::from(__DIR__ . '/../Fixtures/orders_flow.parquet')->extract(new FlowContext(Config::default())) as $rows) { + } } } diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Benchmark/TextExtractorBench.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Benchmark/TextExtractorBench.php index c49518bff..29573e237 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Benchmark/TextExtractorBench.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Benchmark/TextExtractorBench.php @@ -16,6 +16,7 @@ final class TextExtractorBench #[Revs(5)] public function bench_extract() : void { - \iterator_to_array(Text::from(__DIR__ . '/../Fixtures/annual-enterprise-survey-2019-financial-year-provisional-csv.csv')->extract(new FlowContext(Config::default()))); + foreach (Text::from(__DIR__ . '/../Fixtures/annual-enterprise-survey-2019-financial-year-provisional-csv.csv')->extract(new FlowContext(Config::default())) as $rows) { + } } } diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Benchmark/XmlExtractorBench.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Benchmark/XmlExtractorBench.php index 67b873b7a..f58c9a793 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Benchmark/XmlExtractorBench.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Benchmark/XmlExtractorBench.php @@ -16,6 +16,7 @@ final class XmlExtractorBench #[Revs(5)] public function bench_extract() : void { - \iterator_to_array(XML::from(__DIR__ . '/../Fixtures/simple_items.xml')->extract(new FlowContext(Config::default()))); + foreach (XML::from(__DIR__ . '/../Fixtures/simple_items.xml')->extract(new FlowContext(Config::default())) as $rows) { + } } }