InvestorsHub Logo
Followers 211
Posts 7903
Boards Moderated 15
Alias Born 05/24/2001

Re: Dimension post# 60441

Wednesday, 11/09/2005 12:58:20 AM

Wednesday, November 09, 2005 12:58:20 AM

Post# of 218010
What I try to do, and what MSFT tries to make it more and more difficult to do, to such an extent that my mindset is completely foreign to any younger programmers, is when I'm writing code, I picture what the work I'm doing would look like in Assembler, the closest thing to machine language with which I'm at least somewhat familiar.

I'm unmoved by the simplicity for the programmer to use try/catch, but instead think about what the machine has to do each time it encounters that code.

In much the same way that instead of:

If var1=true and var2>3 then 
....
end if


I'll do:
 
If var1=true then
if var2 > 3 then
...
end if
end if


Because it's easier on the hardware. In the first example, both variables are checked in any language with which I'm familiar. Even if the first one tested false.

So if the first var will test false half the time, the second approach saves 50% overhead because var2 is only checked the 50% of the time that var1 is true.

In an interpreted language like classic ASP (every line is read and compiled at runtime), the benefits of the second method probably aren't equal to the punishment of additional lines of code. Well, maybe so. Since the inside IF loop won't be looked at, even in classic ASP.

I don't do it this way all the time. But I tend toward it in often-used routines, especially when I'm trying to tweak another 1ms performance out of them.

Most modern programmers are blissfully unaware of the fact that all parts of an IF are tested, even if a false one is encountered.

That said, there are a LOT of inefficiences in my own code that I'm well aware of and haven't taken the time to fix. And I'm even more keenly aware of the fact that I'm really not using the best parts of .NET in my implementation on SI because I've never really learned the language.

Basically, the main two things I've taken advantage of with ASP.NET is that, since it's a compiled language, it runs a helluva lot faster, and it ignores comments, where they can be costly in classic ASP, and I love the way it interacts with a SQL database.
Join InvestorsHub

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.