I am implementing Perl module which uses DBI and XML::XParent. It works really slow and I would like to increase the speed of my code. I have changed everything following the other posts, tutorials etc but it was not a solution - I mean, I prepare statements, I use arrayref instead of array etc.

My question is associated with logic. My code parses the XML and during this adds a lot of records into the database (but only one with one query).

I want to ask, is it bad idea to create a SQL script during the parsing and invoke it once after that? Should it increase the speed of my module?