A new definition of efficiency
-
Just saw this posted on another forum
List _chars = new List();
for (int i = 0; i < 2000; i++)
{
if ((i >= 48 && i <= 57) || (i >= 97 && i <= 122))
{
_chars.Add((char)i);
}
}The author claimed that the code "work efficiently". I wonder how the upper limit of 2000 was determined? Why not int.MaxValue? Then you could maximise the inefficiency. Of course, you could do better with a long, or a lower bound of int.MinValue but that's getting silly. The way _chars was used later all that was required was
string _chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
Just saw this posted on another forum
List _chars = new List();
for (int i = 0; i < 2000; i++)
{
if ((i >= 48 && i <= 57) || (i >= 97 && i <= 122))
{
_chars.Add((char)i);
}
}The author claimed that the code "work efficiently". I wonder how the upper limit of 2000 was determined? Why not int.MaxValue? Then you could maximise the inefficiency. Of course, you could do better with a long, or a lower bound of int.MinValue but that's getting silly. The way _chars was used later all that was required was
string _chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
Just saw this posted on another forum
List _chars = new List();
for (int i = 0; i < 2000; i++)
{
if ((i >= 48 && i <= 57) || (i >= 97 && i <= 122))
{
_chars.Add((char)i);
}
}The author claimed that the code "work efficiently". I wonder how the upper limit of 2000 was determined? Why not int.MaxValue? Then you could maximise the inefficiency. Of course, you could do better with a long, or a lower bound of int.MinValue but that's getting silly. The way _chars was used later all that was required was
string _chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Char.IsLetterOrDigit
might have been a good starting point. Could have wasted hours of the authors time testing to see which was the more efficient :) Interested though if it was also a bug, 97 to 122 are all lowercase, not uppercase."You get that on the big jobs."
-
Just saw this posted on another forum
List _chars = new List();
for (int i = 0; i < 2000; i++)
{
if ((i >= 48 && i <= 57) || (i >= 97 && i <= 122))
{
_chars.Add((char)i);
}
}The author claimed that the code "work efficiently". I wonder how the upper limit of 2000 was determined? Why not int.MaxValue? Then you could maximise the inefficiency. Of course, you could do better with a long, or a lower bound of int.MinValue but that's getting silly. The way _chars was used later all that was required was
string _chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Well obviously it is there "for future expansion". :-D Of the alphabet, I assume...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
Well obviously it is there "for future expansion". :-D Of the alphabet, I assume...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
¥ɛѦ, tĥѦτ ѡĭ└└ ɳɛvɛr ĥѦῤῤɛɳ‼
-
¥ɛѦ, tĥѦτ ѡĭ└└ ɳɛvɛr ĥѦῤῤɛɳ‼
I'm gonna need a bigger keyboard... :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
I'm gonna need a bigger keyboard... :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
All you need is the 'Alt' key and a 10-key pad. Alt-1... ☺
-
Just saw this posted on another forum
List _chars = new List();
for (int i = 0; i < 2000; i++)
{
if ((i >= 48 && i <= 57) || (i >= 97 && i <= 122))
{
_chars.Add((char)i);
}
}The author claimed that the code "work efficiently". I wonder how the upper limit of 2000 was determined? Why not int.MaxValue? Then you could maximise the inefficiency. Of course, you could do better with a long, or a lower bound of int.MinValue but that's getting silly. The way _chars was used later all that was required was
string _chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
¥ɛѦ, tĥѦτ ѡĭ└└ ɳɛvɛr ĥѦῤῤɛɳ‼
If it will not happen then select the code file press shift + delete.. .......If possible.. :laugh:
Read the article "Table Valued Parameters". --Amit
-
All you need is the 'Alt' key and a 10-key pad. Alt-1... ☺
-
Just saw this posted on another forum
List _chars = new List();
for (int i = 0; i < 2000; i++)
{
if ((i >= 48 && i <= 57) || (i >= 97 && i <= 122))
{
_chars.Add((char)i);
}
}The author claimed that the code "work efficiently". I wonder how the upper limit of 2000 was determined? Why not int.MaxValue? Then you could maximise the inefficiency. Of course, you could do better with a long, or a lower bound of int.MinValue but that's getting silly. The way _chars was used later all that was required was
string _chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
I think you meant: string _chars = "0123456789abcdefghijklmnopqrstuvwxyz"; (lowercase) :) 65 = A, 97 = a Your version is definitely more readable (and efficient). Based on the default List length, it might reallocate (and copy) the memory backing the list a few times.