diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8cfeb9c5dc..0022d69755 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -186,6 +186,37 @@ jobs: - name: Static analysis with PHPStan run: ./vendor/bin/phpstan analyse + performance: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib + coverage: none + tools: cs2pr + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Performance tests with PHPBench + run: ./vendor/bin/phpbench run tests/Performance --report=aggregate + coverage: runs-on: ubuntu-latest steps: diff --git a/composer.json b/composer.json index a130e120db..0e1e528eeb 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,9 @@ ], "versions": [ "phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 7.4- -n" + ], + "bench": [ + "phpbench run tests/Performance/ --report=aggregate -n" ] }, "require": { @@ -79,14 +82,15 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "dev-master", - "dompdf/dompdf": "^1.0 || ^2.0", - "friendsofphp/php-cs-fixer": "^3.2", + "dompdf/dompdf": "^2.0", + "friendsofphp/php-cs-fixer": "^3.13", "mitoteam/jpgraph": "^10.2.4", - "mpdf/mpdf": "^8.1.1", + "mpdf/mpdf": "^8.1.2", + "phpbench/phpbench": "^1.2", "phpcompatibility/php-compatibility": "^9.3", - "phpstan/phpstan": "^1.1", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^8.5 || ^9.0", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-phpunit": "^1.2", + "phpunit/phpunit": "^9.0", "squizlabs/php_codesniffer": "^3.7", "tecnickcom/tcpdf": "^6.5" }, @@ -105,6 +109,7 @@ "autoload-dev": { "psr-4": { "PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests", + "PhpOffice\\PhpSpreadsheetPerformance\\": "tests/Performance", "PhpOffice\\PhpSpreadsheetInfra\\": "infra" } } diff --git a/composer.lock b/composer.lock index 9a425e8700..1ca894b7e4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "60da78cdd66329fbd4e0d50324363072", + "content-hash": "dd9ec5edb3ee1bd94f2e2a378399405d", "packages": [ { "name": "ezyang/htmlpurifier", @@ -523,16 +523,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -547,7 +547,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -586,7 +586,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -602,22 +602,22 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" } ], "packages-dev": [ { "name": "composer/pcre", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", "shasum": "" }, "require": { @@ -659,7 +659,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.0.0" + "source": "https://github.com/composer/pcre/tree/3.1.0" }, "funding": [ { @@ -675,7 +675,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T20:21:48+00:00" + "time": "2022-11-17T09:50:14+00:00" }, { "name": "composer/semver", @@ -830,12 +830,12 @@ "source": { "type": "git", "url": "https://github.com/PHPCSStandards/composer-installer.git", - "reference": "231b4e82eee01f16537c8ac3fce31c1f83320c80" + "reference": "cd79216fba0b4000cd27062a5953dbd82e908c12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/231b4e82eee01f16537c8ac3fce31c1f83320c80", - "reference": "231b4e82eee01f16537c8ac3fce31c1f83320c80", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/cd79216fba0b4000cd27062a5953dbd82e908c12", + "reference": "cd79216fba0b4000cd27062a5953dbd82e908c12", "shasum": "" }, "require": { @@ -854,11 +854,11 @@ "default-branch": true, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -901,7 +901,7 @@ "issues": "https://github.com/PHPCSStandards/composer-installer/issues", "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-07-26T12:51:47+00:00" + "time": "2022-11-16T08:42:42+00:00" }, { "name": "doctrine/annotations", @@ -1186,16 +1186,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.11.0", + "version": "v3.13.0", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "7dcdea3f2f5f473464e835be9be55283ff8cfdc3" + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "a6232229a8309e8811dc751c28b91cb34b2943e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7dcdea3f2f5f473464e835be9be55283ff8cfdc3", - "reference": "7dcdea3f2f5f473464e835be9be55283ff8cfdc3", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/a6232229a8309e8811dc751c28b91cb34b2943e1", + "reference": "a6232229a8309e8811dc751c28b91cb34b2943e1", "shasum": "" }, "require": { @@ -1219,7 +1219,7 @@ }, "require-dev": { "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^1.5", + "keradus/cli-executor": "^2.0", "mikey179/vfsstream": "^1.6.10", "php-coveralls/php-coveralls": "^2.5.2", "php-cs-fixer/accessible-object": "^1.1", @@ -1228,8 +1228,8 @@ "phpspec/prophecy": "^1.15", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "phpunitgoodpractices/polyfill": "^1.5", - "phpunitgoodpractices/traits": "^1.9.1", + "phpunitgoodpractices/polyfill": "^1.6", + "phpunitgoodpractices/traits": "^1.9.2", "symfony/phpunit-bridge": "^6.0", "symfony/yaml": "^5.4 || ^6.0" }, @@ -1262,8 +1262,8 @@ ], "description": "A tool to automatically fix PHP code style", "support": { - "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.11.0" + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.13.0" }, "funding": [ { @@ -1271,7 +1271,7 @@ "type": "github" } ], - "time": "2022-09-01T18:24:51+00:00" + "time": "2022-10-31T19:28:50+00:00" }, { "name": "masterminds/html5", @@ -1526,16 +1526,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.1", + "version": "v4.15.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "shasum": "" }, "require": { @@ -1576,9 +1576,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" }, - "time": "2022-09-04T07:30:47+00:00" + "time": "2022-11-12T15:38:23+00:00" }, { "name": "paragonie/random_compat", @@ -1885,6 +1885,198 @@ }, "time": "2015-12-19T14:08:53+00:00" }, + { + "name": "phpbench/container", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpbench/container.git", + "reference": "6d555ff7174fca13f9b1ec0b4a089ed41d0ab392" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbench/container/zipball/6d555ff7174fca13f9b1ec0b4a089ed41d0ab392", + "reference": "6d555ff7174fca13f9b1ec0b4a089ed41d0ab392", + "shasum": "" + }, + "require": { + "psr/container": "^1.0|^2.0", + "symfony/options-resolver": "^4.2 || ^5.0 || ^6.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "phpstan/phpstan": "^0.12.52", + "phpunit/phpunit": "^8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "PhpBench\\DependencyInjection\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Leech", + "email": "daniel@dantleech.com" + } + ], + "description": "Simple, configurable, service container.", + "support": { + "issues": "https://github.com/phpbench/container/issues", + "source": "https://github.com/phpbench/container/tree/2.2.1" + }, + "time": "2022-01-25T10:17:35+00:00" + }, + { + "name": "phpbench/dom", + "version": "0.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpbench/dom.git", + "reference": "b013b717832ddbaadf2a40984b04bc66af9a7110" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbench/dom/zipball/b013b717832ddbaadf2a40984b04bc66af9a7110", + "reference": "b013b717832ddbaadf2a40984b04bc66af9a7110", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": "^7.2||^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.18", + "phpstan/phpstan": "^0.12.83", + "phpunit/phpunit": "^8.0||^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpBench\\Dom\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Leech", + "email": "daniel@dantleech.com" + } + ], + "description": "DOM wrapper to simplify working with the PHP DOM implementation", + "support": { + "issues": "https://github.com/phpbench/dom/issues", + "source": "https://github.com/phpbench/dom/tree/0.3.2" + }, + "time": "2021-09-24T15:26:07+00:00" + }, + { + "name": "phpbench/phpbench", + "version": "1.2.7", + "source": { + "type": "git", + "url": "https://github.com/phpbench/phpbench.git", + "reference": "dce145304abbb16c8d9af69c19d96f47e9d0e670" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbench/phpbench/zipball/dce145304abbb16c8d9af69c19d96f47e9d0e670", + "reference": "dce145304abbb16c8d9af69c19d96f47e9d0e670", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.13", + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "ext-tokenizer": "*", + "php": "^7.3 || ^8.0", + "phpbench/container": "^2.1", + "phpbench/dom": "~0.3.1", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "seld/jsonlint": "^1.1", + "symfony/console": "^4.2 || ^5.0 || ^6.0", + "symfony/filesystem": "^4.2 || ^5.0 || ^6.0", + "symfony/finder": "^4.2 || ^5.0 || ^6.0", + "symfony/options-resolver": "^4.2 || ^5.0 || ^6.0", + "symfony/process": "^4.2 || ^5.0 || ^6.0", + "webmozart/glob": "^4.6" + }, + "require-dev": { + "dantleech/invoke": "^2.0", + "friendsofphp/php-cs-fixer": "^3.0", + "jangregor/phpstan-prophecy": "^1.0", + "phpspec/prophecy": "^1.12", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^8.5.8 || ^9.0", + "symfony/error-handler": "^5.2 || ^6.0", + "symfony/var-dumper": "^4.0 || ^5.0 || ^6.0" + }, + "suggest": { + "ext-xdebug": "For Xdebug profiling extension." + }, + "bin": [ + "bin/phpbench" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "files": [ + "lib/Report/Func/functions.php" + ], + "psr-4": { + "PhpBench\\": "lib/", + "PhpBench\\Extensions\\XDebug\\": "extensions/xdebug/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Leech", + "email": "daniel@dantleech.com" + } + ], + "description": "PHP Benchmarking Framework", + "support": { + "issues": "https://github.com/phpbench/phpbench/issues", + "source": "https://github.com/phpbench/phpbench/tree/1.2.7" + }, + "funding": [ + { + "url": "https://github.com/dantleech", + "type": "github" + } + ], + "time": "2022-10-15T09:57:51+00:00" + }, { "name": "phpcompatibility/php-compatibility", "version": "9.3.5", @@ -1949,16 +2141,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.6", + "version": "1.9.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618" + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c386ab2741e64cc9e21729f891b28b2b10fe6618", - "reference": "c386ab2741e64cc9e21729f891b28b2b10fe6618", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d6fdf01c53978b6429f1393ba4afeca39cc68afa", + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa", "shasum": "" }, "require": { @@ -1988,7 +2180,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.6" + "source": "https://github.com/phpstan/phpstan/tree/1.9.2" }, "funding": [ { @@ -2004,25 +2196,25 @@ "type": "tidelift" } ], - "time": "2022-09-23T09:54:39+00:00" + "time": "2022-11-10T09:56:11+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "1.1.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84" + "reference": "dea1f87344c6964c607d9076dee42d891f3923f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/dea1f87344c6964c607d9076dee42d891f3923f0", + "reference": "dea1f87344c6964c607d9076dee42d891f3923f0", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.5.0" + "phpstan/phpstan": "^1.8.11" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -2054,22 +2246,22 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.1" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.2.2" }, - "time": "2022-04-20T15:24:25+00:00" + "time": "2022-10-28T10:23:07+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.17", + "version": "9.2.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" + "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", + "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", "shasum": "" }, "require": { @@ -2125,7 +2317,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" }, "funding": [ { @@ -2133,7 +2325,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2022-11-18T07:47:47+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2378,16 +2570,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.25", + "version": "9.5.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", "shasum": "" }, "require": { @@ -2460,7 +2652,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" }, "funding": [ { @@ -2476,7 +2668,7 @@ "type": "tidelift" } ], - "time": "2022-09-25T03:44:45+00:00" + "time": "2022-10-28T06:00:21+00:00" }, { "name": "psr/cache", @@ -3692,6 +3884,70 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "seld/jsonlint", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "4211420d25eba80712bff236a98960ef68b866b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/4211420d25eba80712bff236a98960ef68b866b7", + "reference": "4211420d25eba80712bff236a98960ef68b866b7", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.9.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", + "type": "tidelift" + } + ], + "time": "2022-04-01T13:37:23+00:00" + }, { "name": "setasign/fpdi", "version": "v2.3.6", @@ -3822,16 +4078,16 @@ }, { "name": "symfony/console", - "version": "v5.4.12", + "version": "v5.4.15", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1" + "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c072aa8f724c3af64e2c7a96b796a4863d24dba1", - "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1", + "url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669", + "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669", "shasum": "" }, "require": { @@ -3901,7 +4157,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.12" + "source": "https://github.com/symfony/console/tree/v5.4.15" }, "funding": [ { @@ -3917,7 +4173,7 @@ "type": "tidelift" } ], - "time": "2022-08-17T13:18:05+00:00" + "time": "2022-10-26T21:41:52+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4152,16 +4408,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.12", + "version": "v5.4.13", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "2d67c1f9a1937406a9be3171b4b22250c0a11447" + "reference": "ac09569844a9109a5966b9438fc29113ce77cf51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/2d67c1f9a1937406a9be3171b4b22250c0a11447", - "reference": "2d67c1f9a1937406a9be3171b4b22250c0a11447", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51", + "reference": "ac09569844a9109a5966b9438fc29113ce77cf51", "shasum": "" }, "require": { @@ -4196,7 +4452,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.12" + "source": "https://github.com/symfony/filesystem/tree/v5.4.13" }, "funding": [ { @@ -4212,7 +4468,7 @@ "type": "tidelift" } ], - "time": "2022-08-02T13:48:16+00:00" + "time": "2022-09-21T19:53:16+00:00" }, { "name": "symfony/finder", @@ -4348,16 +4604,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -4372,7 +4628,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4410,7 +4666,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -4426,20 +4682,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "433d05519ce6990bf3530fba6957499d327395c2" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", - "reference": "433d05519ce6990bf3530fba6957499d327395c2", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { @@ -4451,7 +4707,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4491,7 +4747,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -4507,20 +4763,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -4532,7 +4788,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4575,7 +4831,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -4591,20 +4847,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -4613,7 +4869,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4654,7 +4910,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -4670,20 +4926,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -4692,7 +4948,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4737,7 +4993,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -4753,20 +5009,20 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", - "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", "shasum": "" }, "require": { @@ -4775,7 +5031,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4816,7 +5072,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" }, "funding": [ { @@ -4832,7 +5088,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", @@ -4981,16 +5237,16 @@ }, { "name": "symfony/stopwatch", - "version": "v5.4.5", + "version": "v5.4.13", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" + "reference": "6df7a3effde34d81717bbef4591e5ffe32226d69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6df7a3effde34d81717bbef4591e5ffe32226d69", + "reference": "6df7a3effde34d81717bbef4591e5ffe32226d69", "shasum": "" }, "require": { @@ -5023,7 +5279,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.13" }, "funding": [ { @@ -5039,20 +5295,20 @@ "type": "tidelift" } ], - "time": "2022-02-18T16:06:09+00:00" + "time": "2022-09-28T13:19:49+00:00" }, { "name": "symfony/string", - "version": "v5.4.12", + "version": "v5.4.15", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058" + "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/2fc515e512d721bf31ea76bd02fe23ada4640058", - "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058", + "url": "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", + "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", "shasum": "" }, "require": { @@ -5109,7 +5365,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.12" + "source": "https://github.com/symfony/string/tree/v5.4.15" }, "funding": [ { @@ -5125,7 +5381,7 @@ "type": "tidelift" } ], - "time": "2022-08-12T17:03:11+00:00" + "time": "2022-10-05T15:16:54+00:00" }, { "name": "tecnickcom/tcpdf", @@ -5248,6 +5504,55 @@ } ], "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "webmozart/glob", + "version": "4.6.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/glob.git", + "reference": "3c17f7dec3d9d0e87b575026011f2e75a56ed655" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/glob/zipball/3c17f7dec3d9d0e87b575026011f2e75a56ed655", + "reference": "3c17f7dec3d9d0e87b575026011f2e75a56ed655", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "symfony/filesystem": "^5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Glob\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A PHP implementation of Ant's glob.", + "support": { + "issues": "https://github.com/webmozarts/glob/issues", + "source": "https://github.com/webmozarts/glob/tree/4.6.0" + }, + "time": "2022-05-24T19:45:58+00:00" } ], "aliases": [], @@ -5258,7 +5563,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "ext-ctype": "*", "ext-dom": "*", "ext-fileinfo": "*", @@ -5274,5 +5579,5 @@ "ext-zlib": "*" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/phpbench.json b/phpbench.json new file mode 100644 index 0000000000..b1322b6e5f --- /dev/null +++ b/phpbench.json @@ -0,0 +1,5 @@ +{ + "$schema":"./vendor/phpbench/phpbench/phpbench.schema.json", + "runner.bootstrap": "vendor/autoload.php", + "runner.file_pattern": "*Benchmark.php" +} diff --git a/tests/Performance/Cell/CoordinateBenchmark.php b/tests/Performance/Cell/CoordinateBenchmark.php new file mode 100644 index 0000000000..5786201b80 --- /dev/null +++ b/tests/Performance/Cell/CoordinateBenchmark.php @@ -0,0 +1,91 @@ +columns = 16384; // Xlsx Max Column Index + $this->rows = 16; + $this->columnMaxAddress = Coordinate::stringFromColumnIndex($this->columns); + ++$this->columnMaxAddress; + } + + /** + * @Warmup(2) + * @revs(10) + * @Iterations(20) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkColumnIndexFromString(): void + { + for ($column = 'A'; $column !== $this->columnMaxAddress; ++$column) { + $index = Coordinate::columnIndexFromString($column); + } + } + + /** + * @Warmup(2) + * @revs(10) + * @Iterations(20) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkStringFromColumnIndex(): void + { + for ($column = 1; $column <= $this->columns; ++$column) { + $index = Coordinate::stringFromColumnIndex($column); + } + } + + /** + * @Warmup(2) + * @revs(5) + * @Iterations(10) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkCoordinateFromString(): void + { + for ($column = 'A'; $column !== $this->columnMaxAddress; ++$column) { + for ($row = 1; $row <= $this->rows; ++$row) { + $coordinateArray = Coordinate::coordinateFromString("{$column}{$row}"); + } + } + } + + /** + * @Warmup(2) + * @revs(5) + * @Iterations(10) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkIndexesFromString(): void + { + for ($column = 'A'; $column !== $this->columnMaxAddress; ++$column) { + for ($row = 1; $row <= $this->rows; ++$row) { + $coordinateArray = Coordinate::indexesFromString("{$column}{$row}"); + } + } + } +} diff --git a/tests/Performance/Collection/AbstractCellCollection.php b/tests/Performance/Collection/AbstractCellCollection.php new file mode 100644 index 0000000000..ea0de60ef4 --- /dev/null +++ b/tests/Performance/Collection/AbstractCellCollection.php @@ -0,0 +1,44 @@ +spreadsheet = new Spreadsheet(); + + $worksheet = $this->spreadsheet->getActiveSheet(); + + $this->buildWorksheet($worksheet, $rows, $columns); + } + + private function buildWorksheet(Worksheet $worksheet, int $rows, int $columns): void + { + $sampleData = [range(1, $columns)]; + + for ($row = 1; $row <= $rows; ++$row) { + $worksheet->fromArray($sampleData, null, "A{$row}", true); + } + } + + public function tearDown(): void + { + if (file_exists($this->fileName)) { + unlink($this->fileName); + } + } +} diff --git a/tests/Performance/Collection/MaxRowColumnBenchmark.php b/tests/Performance/Collection/MaxRowColumnBenchmark.php new file mode 100644 index 0000000000..415b6a48df --- /dev/null +++ b/tests/Performance/Collection/MaxRowColumnBenchmark.php @@ -0,0 +1,71 @@ +spreadsheet->getActiveSheet() + ->getCellCollection()->getHighestRow(); + } + + /** + * @revs(10) + * @Iterations(20) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkGetHighestRowWithArgument(): void + { + $this->spreadsheet->getActiveSheet() + ->getCellCollection()->getHighestRow('EQ'); + } + + /** + * @revs(10) + * @Iterations(20) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkGetHighestColumnNoArgument(): void + { + $this->spreadsheet->getActiveSheet() + ->getCellCollection()->getHighestColumn(); + } + + /** + * @revs(10) + * @Iterations(20) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkGetHighestColumnWithArgument(): void + { + $this->spreadsheet->getActiveSheet() + ->getCellCollection()->getHighestColumn(256); + } + + /** + * @revs(10) + * @Iterations(20) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkGetHighestRowAndColum(): void + { + $this->spreadsheet->getActiveSheet() + ->getCellCollection()->getHighestRowAndColumn(); + } +} diff --git a/tests/Performance/ReferenceHelper/AbstractInsertDelete.php b/tests/Performance/ReferenceHelper/AbstractInsertDelete.php new file mode 100644 index 0000000000..4f6cdb3b56 --- /dev/null +++ b/tests/Performance/ReferenceHelper/AbstractInsertDelete.php @@ -0,0 +1,44 @@ +spreadsheet = new Spreadsheet(); + + $worksheet = $this->spreadsheet->getActiveSheet(); + + $this->buildWorksheet($worksheet, $rows, $columns); + } + + private function buildWorksheet(Worksheet $worksheet, int $rows, int $columns): void + { + $sampleData = [range(1, $columns)]; + + for ($row = 1; $row <= $rows; ++$row) { + $worksheet->fromArray($sampleData, null, "A{$row}", true); + } + } + + public function tearDown(): void + { + if (file_exists($this->fileName)) { + unlink($this->fileName); + } + } +} diff --git a/tests/Performance/ReferenceHelper/InsertColumnBenchmark.php b/tests/Performance/ReferenceHelper/InsertColumnBenchmark.php new file mode 100644 index 0000000000..21c2280121 --- /dev/null +++ b/tests/Performance/ReferenceHelper/InsertColumnBenchmark.php @@ -0,0 +1,47 @@ +spreadsheet->getActiveSheet()->insertNewColumnBefore('C', 2); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(4) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkInsertColumnsMid(): void + { + $this->spreadsheet->getActiveSheet()->insertNewColumnBefore('AB', 2); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(7) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkInsertColumnsLate(): void + { + $this->spreadsheet->getActiveSheet()->insertNewColumnBefore('BX', 2); + } +} diff --git a/tests/Performance/ReferenceHelper/InsertRowBenchmark.php b/tests/Performance/ReferenceHelper/InsertRowBenchmark.php new file mode 100644 index 0000000000..cd1ae7262a --- /dev/null +++ b/tests/Performance/ReferenceHelper/InsertRowBenchmark.php @@ -0,0 +1,47 @@ +spreadsheet->getActiveSheet()->insertNewRowBefore(2, 4); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(4) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkInsertRowsMid(): void + { + $this->spreadsheet->getActiveSheet()->insertNewRowBefore(255, 4); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(7) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkInsertRowsLate(): void + { + $this->spreadsheet->getActiveSheet()->insertNewRowBefore(510, 4); + } +} diff --git a/tests/Performance/ReferenceHelper/RemoveColumnBenchmark.php b/tests/Performance/ReferenceHelper/RemoveColumnBenchmark.php new file mode 100644 index 0000000000..afd321e1df --- /dev/null +++ b/tests/Performance/ReferenceHelper/RemoveColumnBenchmark.php @@ -0,0 +1,47 @@ +spreadsheet->getActiveSheet()->removeColumn('C', 2); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(4) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkRemoveColumnsMid(): void + { + $this->spreadsheet->getActiveSheet()->removeColumn('AB', 2); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(7) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkRemoveColumnsLate(): void + { + $this->spreadsheet->getActiveSheet()->removeColumn('BX', 2); + } +} diff --git a/tests/Performance/ReferenceHelper/RemoveRowBenchmark.php b/tests/Performance/ReferenceHelper/RemoveRowBenchmark.php new file mode 100644 index 0000000000..3068d404c6 --- /dev/null +++ b/tests/Performance/ReferenceHelper/RemoveRowBenchmark.php @@ -0,0 +1,47 @@ +spreadsheet->getActiveSheet()->removeRow(2, 4); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(4) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkRemoveRowsMid(): void + { + $this->spreadsheet->getActiveSheet()->removeRow(255, 4); + } + + /** + * @Groups({"slow"}) + * @revs(4) + * @Iterations(7) + * @OutputTimeUnit("milliseconds") + * @AfterMethods("tearDown") + */ + public function benchmarkRemoveRowsLate(): void + { + $this->spreadsheet->getActiveSheet()->removeRow(510, 4); + } +} diff --git a/tests/Performance/Worksheet/MergeCellsBenchmark.php b/tests/Performance/Worksheet/MergeCellsBenchmark.php new file mode 100644 index 0000000000..b19b8debff --- /dev/null +++ b/tests/Performance/Worksheet/MergeCellsBenchmark.php @@ -0,0 +1,28 @@ +spreadsheet->getActiveSheet()->mergeCells([$column, $row, $column + 2, $row + 2]); + } + } + } +} diff --git a/tests/Performance/Worksheet/PopulateWorksheetBenchmark.php b/tests/Performance/Worksheet/PopulateWorksheetBenchmark.php new file mode 100644 index 0000000000..bbd3a98ab8 --- /dev/null +++ b/tests/Performance/Worksheet/PopulateWorksheetBenchmark.php @@ -0,0 +1,115 @@ +columns = 64; + $this->rows = 1024; + $this->columnMaxAddress = Coordinate::stringFromColumnIndex($this->columns); + ++$this->columnMaxAddress; + + $this->spreadsheet = new Spreadsheet(); + $this->worksheet = $this->spreadsheet->getActiveSheet(); + + $this->sampleDataInteger = range(1, $this->columns); + $this->sampleDataString = array_fill(0, $this->columns, 'Hello World'); + } + + /** + * @revs(5) + * @Iterations(5) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkPopulateIntegerValuesByCell(): void + { + for ($row = 1; $row <= $this->rows; ++$row) { + for ($column = 'A'; $column !== $this->columnMaxAddress; ++$column) { + $this->worksheet->setCellValue("{$column}{$row}", 1); + } + } + } + + /** + * @revs(5) + * @Iterations(5) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkPopulateStringValuesByCell(): void + { + for ($row = 1; $row <= $this->rows; ++$row) { + for ($column = 'A'; $column !== $this->columnMaxAddress; ++$column) { + $this->worksheet->setCellValue("{$column}{$row}", 'Hello World'); + } + } + } + + /** + * @revs(5) + * @Iterations(5) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkPopulateIntegerValuesFromArray(): void + { + for ($row = 1; $row <= $this->rows; ++$row) { + $this->worksheet->fromArray($this->sampleDataInteger, null, "A{$row}", true); + } + } + + /** + * @revs(5) + * @Iterations(5) + * @OutputTimeUnit("milliseconds") + * @BeforeMethods("setUp") + */ + public function benchmarkPopulateStringValuesFromArray(): void + { + for ($row = 1; $row <= $this->rows; ++$row) { + $this->worksheet->fromArray($this->sampleDataString, null, "A{$row}", true); + } + } +} diff --git a/tests/Performance/Writer/AbstractBasicWriter.php b/tests/Performance/Writer/AbstractBasicWriter.php new file mode 100644 index 0000000000..02874f2638 --- /dev/null +++ b/tests/Performance/Writer/AbstractBasicWriter.php @@ -0,0 +1,44 @@ +spreadsheet = new Spreadsheet(); + + $worksheet = $this->spreadsheet->getActiveSheet(); + + $this->buildWorksheet($worksheet, $rows, $columns); + } + + private function buildWorksheet(Worksheet $worksheet, int $rows, int $columns): void + { + $sampleData = [range(1, $columns)]; + + for ($row = 1; $row <= $rows; ++$row) { + $worksheet->fromArray($sampleData, null, "A{$row}", true); + } + } + + public function tearDown(): void + { + if (file_exists($this->fileName)) { + unlink($this->fileName); + } + } +} diff --git a/tests/Performance/Writer/Html/HtmlWriterBenchmark.php b/tests/Performance/Writer/Html/HtmlWriterBenchmark.php new file mode 100644 index 0000000000..d1dfd45f70 --- /dev/null +++ b/tests/Performance/Writer/Html/HtmlWriterBenchmark.php @@ -0,0 +1,21 @@ +spreadsheet); + $writer->save($this->fileName); + } +} diff --git a/tests/Performance/Writer/Ods/OdsWriterBenchmark.php b/tests/Performance/Writer/Ods/OdsWriterBenchmark.php new file mode 100644 index 0000000000..c57b57d8b5 --- /dev/null +++ b/tests/Performance/Writer/Ods/OdsWriterBenchmark.php @@ -0,0 +1,21 @@ +spreadsheet); + $writer->save($this->fileName); + } +} diff --git a/tests/Performance/Writer/Xls/XlsWriterBenchmark.php b/tests/Performance/Writer/Xls/XlsWriterBenchmark.php new file mode 100644 index 0000000000..834b0c6b11 --- /dev/null +++ b/tests/Performance/Writer/Xls/XlsWriterBenchmark.php @@ -0,0 +1,21 @@ +spreadsheet); + $writer->save($this->fileName); + } +} diff --git a/tests/Performance/Writer/Xls/XlsWriterLargeBenchmark.php b/tests/Performance/Writer/Xls/XlsWriterLargeBenchmark.php new file mode 100644 index 0000000000..0c47e763c4 --- /dev/null +++ b/tests/Performance/Writer/Xls/XlsWriterLargeBenchmark.php @@ -0,0 +1,27 @@ +spreadsheet); + $writer->save($this->fileName); + } +} diff --git a/tests/Performance/Writer/Xlsx/XlsxWriterBenchmark.php b/tests/Performance/Writer/Xlsx/XlsxWriterBenchmark.php new file mode 100644 index 0000000000..bc2153285f --- /dev/null +++ b/tests/Performance/Writer/Xlsx/XlsxWriterBenchmark.php @@ -0,0 +1,21 @@ +spreadsheet); + $writer->save($this->fileName); + } +} diff --git a/tests/Performance/Writer/Xlsx/XlsxWriterLargeBenchmark.php b/tests/Performance/Writer/Xlsx/XlsxWriterLargeBenchmark.php new file mode 100644 index 0000000000..8bfefd65d4 --- /dev/null +++ b/tests/Performance/Writer/Xlsx/XlsxWriterLargeBenchmark.php @@ -0,0 +1,27 @@ +spreadsheet); + $writer->save($this->fileName); + } +}