sebastianbergmann / dbunit

DbUnit port for PHP/PHPUnit.
https://phpunit.de/
Other
225 stars 186 forks source link

createMySQLXMLDataSet memory consumption #157

Closed baronmog closed 6 years ago

baronmog commented 9 years ago

710MB & 5.85 min run time to load a 51MB file generated by mysqldump --xml seems excessive.

This is running on an Arch Linux 64-bit system, php v5.6.7 and the PHPUnit v4.6.2 phar.

elazar commented 9 years ago

I would suggest using a profiler like Xdebug (with one of WinCacheGrind / MacCallGrind / KCacheGrind / WebGrind) or xhprof (with xhgui) to isolate what's causing the inflated memory usage.

Offhand, I know that createMySQLXMLDataSet() simply returns an instance of MysqlXmlDataSet, which extends AbstractXmlDataSet, which uses SimpleXML for parsing. That coupled with an XML file that large may be contributing to the excessive memory usage and runtime you're seeing.

If that is indeed the issue, refactoring AbstractXmlDataSet and its subclasses to use something other than SimpleXML is a non-trivial project; I'd suggest creating and using your own data set implementation using something like XMLReader instead of SimpleXML to confirm that addresses the issue.

sebastianbergmann commented 9 years ago

Using SimpleXML is almost always a bad idea. XMLReader would be a good XML API for this task, I think.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.