in reply to Re^2: Memory Efficient XML Parser
in thread Memory Efficient XML Parser
Wait a second, could you show us a bit more of the code? It looks as if you were first extracting all data in the XML, building a huge string and then tried to shove the whole string into the database. I'm not surprised the script and the database need a lot of memory and CPU time to cope with that!
It would be much better to parse one row, insert it to the database using a prepare()d statement handle, forget its data, parse the next one ... and if you want to optimize it and don't mind that it's a tiny little bit more complex, open the database connection with AutoCommit=>0 and commit only after every 1000 rows (you may need to do some benchmarking to find the right number here).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Memory Efficient XML Parser
by perlgoon (Initiate) on Dec 18, 2007 at 16:53 UTC | |
by Jenda (Abbot) on Dec 18, 2007 at 18:26 UTC |