Linked Questions

3 votes
0 answers
2k views

A debate has been going on at work about using Convert.ChangeType. A couple of fundamental assumptions to this discussion are delineated below: 1. The discussion is within the context of web ...
Veverke's user avatar
  • 541
63 votes
17 answers
38k views

I am working in a .Net, C# shop and I have a coworker that keeps insisting that we should use giant Switch statements in our code with lots of "Cases" rather than more object oriented approaches. His ...
James P. Wright's user avatar
30 votes
6 answers
22k views

There seems to be rough equivalents of instructions to equate to the cost of a branch miss virtual functions have a similar tradeoff: instruction vs. data cache miss optimization barrier If you ...
Glenn Teitelbaum's user avatar
8 votes
6 answers
2k views

How can I write functions that are reusable without sacrificing performance? I am repeatedly coming up against the situation where I want to write a function in a way that makes it reusable (e.g. it ...
Caltor's user avatar
  • 189
12 votes
4 answers
921 views

Occasionally there is the 1% of code that is computationally intensive enough that needs the heaviest kind of low-level optimization. Examples are video processing, image processing, and all kinds of ...
rwong's user avatar
  • 17.2k
3 votes
6 answers
888 views

So I was recently given a coding assignment from a large financial firm, and I thought of two ways to solve the problem. One of the ways involved 1 outer for loop and 1 inner for loop. In this case, ...
Tyler M's user avatar
  • 89
3 votes
2 answers
372 views

Say that I have the following situation: void myFunc() { int x; //Do something with x } "x" is placed on the stack which is no doubt fast. Now, "myFunc" is called very frequently, lets say ...
Nitkov's user avatar
  • 159
1 vote
5 answers
1k views

In our code base, I see a lot of code like this var error = ValidatePhoneNumber(userId, phoneNumber); //if validation fails, return error if(!string.IsNullOrEmpty(error)) { return error; } If I ...
Microsoft Excel's user avatar
1 vote
2 answers
839 views

My question is not about dilemma between clean code vs performance, but I want to understand exact issue with declaring variables and sharing them between functions. I read in many threads, that from ...
pajczur's user avatar
  • 123
2 votes
1 answer
485 views

I have been coding in python for a little over a year, and I have learned a lot and developed quite a few applications, in the process. I do not program for my profession, I simply program ...
NewCoder18's user avatar
-1 votes
2 answers
437 views

In general, the more concise & flexible a language is the slower is the execution of programs written in this language. on the other side, the fast languages are mostly overly verbose, requiring ...
Philomath's user avatar
  • 115
-3 votes
2 answers
2k views

Is code that runs fast but written with a bad and hard to understand syntax, good code? Is code that runs slowly but written with a good and easy to understand syntax, good code?
Ibrahim Ipek's user avatar
-1 votes
1 answer
176 views

Formatting with Indentations, White spaces, and New Lines obviously fit into the coding style category. if (a == b) { foo(); } // vs if (a == b) { foo(); } On the other hand, something that ...
Zsw's user avatar
  • 163