Optimization is the process of improving an existing program to make it work more efficiently or/and using less resources.

learn more… | top users | synonyms (1)

114
votes
30answers
10k views

Is micro-optimisation important when coding?

I recently asked a question on Stack Overflow to find out why isset() was faster than strlen() in PHP. This raised questions around the importance of readable code and whether performance improvements ...
38
votes
9answers
2k views

When is optimization not premature and therefore not evil?

"Premature optimization is root of all evil" is something almost all of us have heard/read. What I am curious what kind of optimization not premature, i.e. at every stage of software development (high ...
75
votes
16answers
14k views

Is premature optimization really the root of all evil?

A colleague of mine today committed a class called ThreadLocalFormat, which basically moved instances of Java Format classes into a thread local, since they are not thread safe and "relatively ...
4
votes
3answers
226 views

How to best approach planning and budgeting of software performance optimization efforts?

There is a software system that has been with the client for some time now. If is feature-rich, mature, complex enterprise application that client uses in production. Due to the rapid expansion of the ...
50
votes
9answers
6k views

Clean readable code vs fast hard to read code. When to cross the line?

When I write code I always try to make my code as clean and readable as possible. Every now and then there comes a time when you need to cross the line and go from nice clean code to slightly uglier ...
7
votes
3answers
371 views

Change of the complexity class through compiler optimization?

I am looking for an example where an algorithm is apparently changing its complexity class due to compiler and/or processor optimization strategies.
65
votes
36answers
6k views

What is the best retort to “premature optimization is the root of all evil” [closed]

Often I hear the sentiment ... "Why worry about performance, write slow code, get your product to market ... don't worry about performance. You can sort that out later" The culmination of this ...
29
votes
16answers
3k views

Should you sacrifice code readability with how efficient code is? [closed]

Should you sacrifice code readability with how efficient code is? e.g. 3 lines of code into 1 line. I read in Code Craft by Pete Goodliffe that readability is key. Your thoughts?
56
votes
16answers
2k views

Why should I care about micro performance and efficency?

Many questions and answers on the C/C++ pages, specifically or indirectly discuss micro performance issues (such is the overhead of an indirect vs direct vs inline function), or using an O(N2) vs ...
11
votes
4answers
619 views

How to document and teach others “optimized beyond recognition” computationally intensive code?

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 ...
19
votes
10answers
621 views

Is it always wrong to optimize before profiling?

I see the mantra of "profiling before optimization" repeated again and again here, on SO, and elsewhere. Although I certainly use profiling tools, I'm only occasionally surprised by the results. It ...
17
votes
18answers
741 views

What do you optimize for? [closed]

Generally speaking, what type of optimizations do you typically slant yourself towards when designing software? Are you the type that prefers to optimize your design for Development time (i.e., ...
11
votes
6answers
7k views

is it realistic to make use of HTML5 local storage to store CSS, and JavaScript

The idea is to make use of HTML5 local storage to store frequently accessed CSS and JavaScript. For example (pseudo-code): var load_from_cdn = true; if (detect local storage) { if (cache of ...
8
votes
10answers
328 views

Where do you optimize?

There are two areas to possibly optimize for speed in: Where the most time is spent The code that is called the most Which is the best place to start optimizing? Often code that is called the ...
4
votes
2answers
125 views

How much configurability to give to users regarding concurrency?

This question is a narrowing-down of these related questions: How much effort should we spend to programming for multiple cores? Concurrency: How do you approach the design and debug the ...
0
votes
4answers
1k views

what is best book to learn optimized programming in java [duplicate]

Possible Duplicate: Is there a canonical book for learning Java as an experienced developer? Let me elaborate a little: I used to be a C/C++ programmer where I used data structure ...
14
votes
7answers
255 views

What optimizations are premature? [duplicate]

I've been here for nearly a month and it seems that people have a tendency to be eager to use the "Premature Optimization is the root of all evil" argument as soon as someone mentions efficiency. ...
13
votes
3answers
504 views

Are web best practices so important if they are always violated by large companies?

Usually, there are a bunch of rules and best practices which help optimizing a website, bring new customers, and in general making user experience fast, smooth and pleasant while (sometimes) reducing ...
6
votes
4answers
204 views

What are some common algorithm optimization opportunities - mathematical or otherwise

What are some common algorithmic optimization opportunities that everyone should be aware of? I have recently be revising/reviewing some code from an application, and noticed that it appeared to be ...
2
votes
3answers
2k views

How do you find the most optimized way to write code?

In my programming career, I have written Java and PHP, Javascript and a little Ruby. I am not a CS major but got into web development from a more broad Internet Professional associates degree, which ...
7
votes
4answers
2k views

How to find bottlenecks in an application? [duplicate]

I'm building an application with lots of components, a lot of which are third-party so I only know what I can get from their documentation. From time to time, by pure luck, I find out one of these ...
5
votes
2answers
430 views

Larger Code is Still Faster

When compiling C code with gcc, there are compiler optimizations, some that limit code size and others create fast code. From the -S flag, I see that the -O2/03 generates more assembly than the -Os ...
5
votes
5answers
333 views

An alternative to requiring red in TDD: reverting code change?

According to this answer to this question, a good reason for always starting with a failing test ("Red") is to make sure that the test is working and that the code that will be written is what makes ...
2
votes
2answers
240 views

Server requests optimisation - size vs frequency

my map-like app loads data from google map API but it also loads some extra data - in the form of XML - from my server. When the app loads it really needs only small amount of data to cover the ...