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

Remove unnecessary call_user_func() to be faster #36

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

staabm
Copy link

@staabm staabm commented Feb 20, 2024

with a test script of

<?php

error_reporting(E_ALL);

require_once __DIR__ . '/vendor/autoload.php';

use Druidfi\Mysqldump as IMysqldump;

$date = date('Ymd');
$dumpSettings = array(
    'no-data' => false,
    'add-drop-table' => true,
    'single-transaction' => true,
    'lock-tables' => false,
    'add-locks' => true,
    'extended-insert' => true,
    'disable-foreign-keys-check' => true,
    'skip-triggers' => false,
    'add-drop-trigger' => true,
    'databases' => true,
    'add-drop-database' => true,
    'hex-blob' => true,
    'include-tables' => array('erp_accounting_value'),
);

$dump = new IMysqldump\Mysqldump("mysql:host=192.168.54.10:33065;dbname=clx_erp", "clxerp_user", "P8_Zyv3_Z3-S1", $dumpSettings);
$dump->setTransformTableRowHook(function ($tableName, $row) {
    return $row;
});
$dump->start("backup$date.sql");

before this PR

mstaab@mst22:/cluster/www/www/www/mysqldump-php$ time php test2.php

real    0m13.046s
user    0m9.917s
sys     0m2.003s
mstaab@mst22:/cluster/www/www/www/mysqldump-php$ time php test2.php

real    0m13.027s
user    0m9.838s
sys     0m2.144s

after this PR

mstaab@mst22:/cluster/www/www/www/mysqldump-php$ time php test2.php

real    0m12.648s
user    0m9.613s
sys     0m1.994s

mstaab@mst22:/cluster/www/www/www/mysqldump-php$ time php test2.php

real    0m12.883s
user    0m9.838s
sys     0m2.008s

@back-2-95 back-2-95 mentioned this pull request Feb 25, 2024
@back-2-95 back-2-95 added the enhancement New feature or request label Feb 25, 2024
@back-2-95 back-2-95 merged commit 178d8c6 into druidfi:main Mar 3, 2024
@staabm staabm deleted the fast-invoke branch March 3, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants