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

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 ...
5
votes
5answers
7k views

Efficient methods for storing tens of millions of objects for querying, with a high number of inserts per second?

This is basically a logging/counting application that is counting the number of packets and counting the type of packet, etc. on a p2p chat network. This equates to about 4-6 million packets in a 5 ...
14
votes
6answers
2k views

It takes me hours to completely understand solutions to 1000-pt problems on TopCoder. Should I get discouraged? [closed]

Sometimes this applies to the 500-pt ones too. I sometimes start feeling I will never improve enough to code them with ease like the others. Should I just quit? If not, why? It is extremely annoying, ...
1
vote
1answer
385 views

Is there a module for writing low level code on Python?

Can you manipulate bits and memory directly using Python? If yes, wouldn't that be a best option to dealing with performance-critical spots than C bindings?
6
votes
4answers
424 views

Optimization as a branch: is that a thing?

My company has highly optimized scientific application which has become so big and complicated that new versions are literally taking t = infinity to produce. (E.G. I have an email which ...
8
votes
6answers
2k views

How can I organize fast and comfortable solution compilation in VS 2010?

Most of programmers who are involved into development of more or less large project(s) know how annoying the process of compilation can be. There are some other things which are dependent on ...
3
votes
4answers
510 views

What factors should I consider when choosing names for identifiers?

What factors do I need to consider when choosing names for identifiers such as variables? I am concerned about space issues, i.e. extra memory consumption when choosing longer names. As an example, ...
10
votes
4answers
557 views

Approaches against code base becoming uniformly slow

We are working on a moderately-sized C++ code base (10Mloc) which through our optimization efforts is becoming uniformly slow. This code base is a set of libraries which we combine to put them to ...
8
votes
3answers
487 views

Is there a general method to evaluate the optimality of an optimization algorithm?

is there a general method to evaluate the optimality of an optimization algorithm, for example an algorithm solving an otherwise NP-hard or NP-complete problem? The only method I came up so far is ...
3
votes
4answers
942 views

Why is C++ known as 'premature optimizaton'? [closed]

"Programming in C++ is premature optimization" Why does everyone do some people say this?
1
vote
3answers
232 views

Is it possible to embed multiple programs into 1

To be more specific, let me explain my end result goal or more of what I would LIKE to have someday and then you can tell me if its even feasible and if not possibly an alternative method. I really ...
3
votes
4answers
1k views

How can I learn about optimising for the CPU cache (in C)?

Reading these two questions, I see that understanding CPU caching behaviour can be important when dealing with large amounts of data in memory. I would like to understand the way the caching works to ...
0
votes
1answer
92 views

Branding websites aimed for mobile devices [closed]

I'm currently working on a website which is also supposed to be mobile optimized. My client has provided me with a layout of how the mobile version of how the website should look like. Making their ...
9
votes
4answers
504 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 ...
4
votes
3answers
328 views

Which of these algorithms is best for my goal?

I have created a program that restricts the mouse to a certain region based on a black/white bitmap. The program is 100% functional as-is, but uses an inaccurate, albeit fast, algorithm for ...
4
votes
3answers
882 views

CPU Architecture and floating-point math

I'm trying to wrap my head around some details about how floating point math is performed on the CPU, trying to better understand what data types to use etc. I think I have a fairly good ...
4
votes
1answer
557 views

Include all php files in one file and include that file in every page if we're using hiphop?

I understand that in normal php if we're including a file we're merging the source of it in the script and it would take longer for that page to be parsed/processed but if we're using HipHop shouldn't ...
3
votes
3answers
594 views

Single click handler for all buttons in Javascript? Is it a pattern? Whats the benefit?

I have been told that when there are multiple buttons on the page for same purpose but targeting different item e.g. delete item on a grid of items, they say it is recommended to just register for ...
0
votes
4answers
105 views

The cross-over between designing for performance/pre-mature optimisation [duplicate]

Possible Duplicate: When is optimization not premature and therefore not evil? Whilst designing my own .Net SQL access library, I found that I want everything thing to run as fast as ...
1
vote
2answers
369 views

What is the best way to insert range of values into a datastructure

If I have a datastructure which is the fastest way I could insert values into it in a specified range? For example if I had a method: myDatastructure var=new myDataStructure(); var.insert(2,1000); ...
4
votes
1answer
161 views

Why there is no ISO hardware query interface?

I'm currently reading a book, chapter about I/O, and one question came to my mind. Basically, when you program in C/C++, you have an amazing opportunity to optimize for hardware behavior. Using ...
7
votes
9answers
973 views

How do I know if the compiler broke my code and what do I do if it was the compiler?

Once in a while C++ code will not work when compiled with some level of optimization. It may be compiler doing optimization that breaks the code or it may be code containing undefined behavior which ...
6
votes
2answers
650 views

How do I optimize a web application for high-latency users?

Basically, I have an application that does searches and requests results from a backend via long polling. It connects to the backend which collects results for 500 ms then sends them back to the ...
8
votes
4answers
288 views

Is microoptimization worth it in mobile devices?

Usually microoptimization is considered not worth it with the following explanation: it might speed up the program by less that one percent, but noone cares of that minor boost - that's just too ...
2
votes
3answers
229 views

Is it worth evaluating compiler optimization on trivial cases?

I'm currently testing Visual C++ 10 on some trivial pieces of code. For example, like this one (taken from here): int main() { int i; clrscr(); ...
3
votes
5answers
324 views

Is it an inefficient workflow to write out code and THEN go back and optimize?

I'm a newer enthusiast programmer. I've been doing small and big projects on and off for the past two or three years. I always hit small snags in my code that add up to big memory hogs or unnecessary ...
8
votes
7answers
4k views

When should I be offloading work to a GPU instead of the CPU?

Newer systems such as OpenCL are being made so that we can run more and more code on our graphics processors, which makes sense, because we should be able to utilise as much of the power in our ...
5
votes
2answers
765 views

How can I best implement 'cache until further notice' with memcache in multiple tiers?

the term "client" used here is not referring to client's browser, but client server Before cache workflow 1. client make a HTTP request --> 2. server process --> 3. store parsed results into ...
10
votes
6answers
6k 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 ...
5
votes
4answers
1k views

How important are PHP notices really?

I recently turned all possible error-messages on with error_reporting(-1);, on my PHP project. Of course, right away I got alot of messages. For example: Notice: Undefined variable: foo in ...
4
votes
3answers
209 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 ...
6
votes
8answers
1k views

How important is it for a programmer to know how to optimize code, solve complex puzzles, answer technical questions quickly?

So I'm in the process of looking for a job. And I have had plenty of test and just recently someone sent me a puzzle. It's the crackless wall problem and I have no idea how to approach it. I could ...
110
votes
30answers
9k 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 ...
2
votes
2answers
429 views

How is switch/case handled as to avoid comparisons to the case values?

I've read in multiple answers that switch/case avoids "unnecessary" comparisons, but I never learned this in college, and I'm a little stumped on how the program would figure out which case to jump to ...
7
votes
2answers
5k views

elevator algorithm and implementation

I wanted to know how (real) elevators work. But, so far, I could not find much material about the algorithms they use, nor software (if any) for simulation. Could anybody give me references for that?
3
votes
1answer
238 views

Algorithm visualization app/plugin

I am looking for an application (or and IDE plugin) that I can use in order to test some algorithms I implement. Mainly metaheuristics used in TSP, VRP and other optimization problems. I have already ...
1
vote
2answers
221 views

How can I make my career in supply chain optimisation and data mining?

There is a company in my city which does supply chain optimization, data mining and predictive modelling. I tried hard but was not able to enter there. Now I want to do similar sort of work. They ...
7
votes
2answers
4k views

Is this a valid smartphone CPU vs. desktop CPU speed comparison (Android G1 vs. old Pentium 4 desktop)?

I am trying to estimate speed differences when creating code on my desktop PC that will be ported to Android phones. I don't need to be exact, but a good estimation will help stop me from creating ...
7
votes
6answers
940 views

Where should code refactoring and optimization fit within both an agile and waterfall process timeline?

There appears to be this notion among the project management team that stating that "it works" means it should then be deemed 100% complete. Most programmers know that isn't always the case. If I'm ...
13
votes
3answers
487 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 ...
3
votes
4answers
1k views

Guidelines for HTML/CSS/JS optimization process

Currently we have a Development server on which we write the HTML/CSS/JS code. We do not optimize our code using compressors/minifiers. So our deployment process from Development to Production is ...
5
votes
4answers
171 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 ...
1
vote
3answers
215 views

What are the various premature optimizations traits / types?

For code review technique training, I have to cover various topics. One of them is premature optimization. I found 3 traits of it as: It's generally evil; causing inverse effects. It's an ...
48
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 ...
3
votes
5answers
315 views

Based on what I read in “Inside the Machine”, is this approach to branches more optimal?

So I have been reading Inside the Machine by Jon Stokes. It is a FANTASTIC book, and it has got me thinking about the effects of programming on processors... Given a branch unit in a CPU and a ...
23
votes
3answers
6k views

How fast can Go go?

Go is one of the few languages that are supposed to run 'close to the metal', i. e. it's compiled, statically typed and executes code natively, without a VM. This should give it a speed advantage over ...
64
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 ...
55
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 ...
5
votes
5answers
325 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 ...
7
votes
4answers
533 views

Computational intensive application: loading vs. querying database

My company has a suite of mature (roots go back 15+ years), computationally intensive applications (simulations) which we use to do consulting work. I work on the simulation/consulting side of the ...