Test1() has a single transaction whereas Test2() has 1000 transactions. You can improve the speed of the Test2() by starting a transaction before starting the loop and committing it after its end.
Test1() has a single transaction whereas Test2() has 1000 transactions. You can improve the speed of the Test2() by starting a transaction before starting the loop and committing it after its end.