if you are dealing with databases and doing alot of insertions/selections from a single "client" try to only open the database connection only once instead of repeatedly. It can sometimes mean the diffrence between a process taking a day and it taking 5hrs.