Wednesday, October 18, 2006

 

Performance Follow up: SqlHelper, object[] vs SqlParameter[]

On a Q&D performance test as suggested by Phil, performance seems to differ only negligably, but on average, I (and the report I cited as well) was wrong.

Calling the methods included in a previous post, 5000 times each,
With parameters took 1203.125 milliseconds.
With objects took 1250 milliseconds.
Objects took -46.875 milliseconds less.
20000 times each:
With parameters took 4859.375 milliseconds.
With objects took 5015.625 milliseconds.
Objects took -156.25 milliseconds less.
If this test is accurrate, it costs pretty much a constant 0.0078 ms to use the SqlHelperParameterCache object to look up the parameters.

Thanks Phil! I think if we go by Haacked's recommendations on optimization, then in this case we should clearly go with the option that renders code most easy to read, write, and maintain.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?