I'm using MySql Connector .NET to load an account and transfer it to the client. This operation is rather intensive, considering the child elements of the account to load.
In Debug mode, it takes, at most, 1 second to load the account. The average would be 500ms. In Release mode, it takes from 1 to 4 seconds to load the account. The average would be 1500ms.
Since there is no #if DEBUG
directive or the like in my code, I'm wondering where the difference is coming from.
Is there a project build option I could change? Or does it have to do with MySql Connector .NET that would have different behaviors depending on the build mode?
EDIT: Ticks monitoring.
Debug (Average: 213000 ticks)
730000
320000
60000
50000
190000
130000
210000
180000
160000
110000
390000
270000
150000
190000
230000
210000
150000
200000
190000
140000
Release (Average: 4404500 ticks)
12940000
170000
180000
80000
80000
130000
120000
5060000
5090000
130000
50000
10430000
25160000
150000
160000
130000
17620000
10160000
100000
150000
Comparison:
Release takes 20x the time Debug takes (average comparison).
4,404,500 / 213,000 = 20
Now the first operation is indeed longer, but in general, so are all the other times for release. Any idea?
EDIT 2: I added even a broader tests that calculates the total time. For 50 account loads, it takes an average of 4 seconds in debugs, and 40 seconds in release. I'm starting to get quite desperate over this - it is a serious performance issue for my application. Does anyone have a guess on how to fix this?