Build multiple insert strings to max=packet size and only then send to mysql it gives a similar speed up to load data infile, and you dont need the arrays.
INSERT [INTO] tbl_name [(col_name,...)] {VALUES | VALUE} ({expr | DEFAULT},...),(...),... in a test I did years ago on a slow (compared to now) ide disk, 800 meg athlon it went from 26 inserts a sec to 2800 inserts a sec Dave Caroline