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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster dump by less tiny writes() #37

Merged
merged 1 commit into from
Mar 3, 2024
Merged

Conversation

staabm
Copy link

@staabm staabm commented Feb 20, 2024

while writing the dump the script is doing millions of tiny writes().

after this PR we are buffering the contents within a string a do the write only after we reached the net-buffer-length.
this means we are doing waaaay less IO calls.

before this PR:

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

real    0m14.194s
user    0m10.762s
sys     0m2.340s

after this PR

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

real    0m7.492s
user    0m6.403s
sys     0m0.204s

which is now 40-50% faster 馃殌

@staabm
Copy link
Author

staabm commented Feb 20, 2024

blackfire profile before this PR

grafik

after this PR (this slow write() path is completely gone)

grafik

the remaining escape slowness is handled in #34

@back-2-95 back-2-95 self-requested a review February 20, 2024 18:05
@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 9165606 into druidfi:main Mar 3, 2024
@staabm staabm deleted the less-writes 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.

None yet

2 participants