Web Dev Matters and Me

Web Development Matters - HTML, XML, C#, .NET, AJAX/Javascript(jQuery), CSS, XML-XSLT

ME - LIFE,Philippines, Tokyo, ECE, PhilNITS/JITSE,情報処理, 日本語

things about Philippines, gaming, C# development and web development, how to make money in stock trading

Web Dev Matters and Me

C# Code Optimizations

Today, I asked few developers from a forum(S.O) about some conversion. On my post, I said my need to get the data by performing bit shifts instead of divisions. Though, most of the people there suggested that it is not something that can improve optimization, I strongly disagree.


So, to make an experiment.. how about trying to make two Stopwatch objects ..
on the method that will be executed, initialize an instance, then invoke the Start method. just below that have a loop that performs 10000 times and inside this loop, perform a multiply operation.

After it exits the loop, invoke the Stop method.

then, on the next line, initialize the second Stopwatch object, invoke the start method and have a loop that performs 10000 times and inside this loop, perform a division operation.

after it exits the loop, invoke the Stop method of this object as well...


You can see the difference by checking on the ElapsedTicks of the Stopwatch objects.. I'm sure you now know what I'm talking about (^_^)



0 comments:

FB Connect