I have recently made my Subnet Calculator class for Xojo available as an open source project. I have included a demo app to help show off the Subnet Calculator Class’ capabilities.
[quote=124883:@Kem Tekinay]Mike, thanks for making that available.
Just a quick FYI: BackgroundTasks False and DisableBackgroundTasks do exactly the same thing.[/quote]
Kem related to your changes… I was always under the impression that IF statemens were faster than Select Case statements. Is this not true?
I think I tested this once and the answer, at the time, was yes. However, unless you are going to be using it in millions of iterations and speed is absolutely critical, I wouldn’t sacrifice code readability and maintenance for it. We are measuring the difference in milliseconds, after all.
Unfortunately when you search for a /30 or 255.255.255.252 you will need to iterate over 4 million subnets so speed is absolutely needed for that specific criteria.
I just tested again and there is no difference in a compiled app. The two variations pitted against each other:
for i as integer = 1 to 1000000
dim x as integer = 3
if x = 0 then
msg = str( x )
elseif x = 1 then
msg = str( x )
elseif x = 2 then
msg = str( x )
elseif x = 3 then
msg = str( x )
end if
next
vs.
for i as integer = 1 to 1000000
dim x as integer = 3
select case x
case 0
msg = str( x )
case 1
msg = str( x )
case 2
msg = str( x )
case 3
msg = str( x )
end
next
However, this variation (the one I replaced in your code) is slower:
for i as integer = 1 to 1000000
dim x as integer = 3
if x = 0 then
msg = str( x )
else
if x = 1 then
msg = str( x )
else
if x = 2 then
msg = str( x )
else
if x = 3 then
msg = str( x )
end if
end if
end if
end if
next