Why does a very simple script which inserts 26,000 records into a mysql database (myisam, no transactions) take 13 seconds in the php implementation, and then 35-50 seconds using mono+mysql connector?
I thought asp.net was faster than php? Could the problem be the mono mysql connector is "platform independent", so the performance just stinks? or does asp.net suffer more overhead than php when it comes to executing each query?
Aren't there any native linux b开发者_运维技巧inaries for mysql connector for mono that may be faster?
Instead of 52,000 insert/update queries, i'm now using StringBuilder (initialized to 1MB size) to construct one long 'replace into' query. It now takes only 3 seconds (on both windows/.net and linux/mono) instead of of 35+ seconds :-)
Thank you Piskvor.
Footnote: I just simplified the php script to do the same thing (create a giant 'replace into' query), and it still takes 13 seconds vs asp.net's 3!
So, it looks like .NET IS faster at a more basic level (at least where string manipulation is concerned) and was only slower when running many queries due to mysql's suboptimal .net connector.
精彩评论