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)

1
vote
4answers
332 views

When should code favour optimization over readability and ease-of-use?

I am in the process of designing a small library, where one of my design goals is that the API should be as close to the domain language as possible. While working on the design, I've noticed that ...
1
vote
2answers
639 views

Registration: Email hash and verifying only one account per email

I'm using a registration function that hashes the email in PBKDF2 with a random and unique Salt each time. The hashes email and his salt are saved in the DB. No problem with that. The problem is that ...
1
vote
3answers
313 views

Allocation problem identification

I have a matrix. I have a list of people who have to occupy n1,n2,n3 etc cells, different number of cells in different rows. I have to place the people in the cells. Occupying the same cell across ...
38
votes
15answers
10k views

How have languages influenced CPU design? [closed]

We are often told that the hardware doesn't care what language a program is written in as it only sees the compiled binary code, however this is not the whole truth. For example, consider the humble ...
2
votes
1answer
101 views

For Which Kind of Cache will this Program not run well? How can it be optimized?

Consider the following code fragment: int a[8192], b[8192], c[8192]; int i; for(i = 0; i < 8192; i++) c[i] = a[i] + b[i]; For what kind of cache will this program not run well (set ...
2
votes
1answer
486 views

Is Google's Page Speed not working fine?

I've been making small improvements to a public ASP.NET site that I have and have ran it through Google's online Page Speed several times. I have a specific problem, but something that really threw me ...
3
votes
4answers
386 views

Does it still make sense to think about effective code on micro scale in C++?

Early in my programming career I was in love with pointer twiddling, lean code, doing everything with as little layers of abstraction as possible and so on. The code was very C like I would say, close ...
15
votes
4answers
763 views

Can applications affect power consumption in a substantial way?

Is there anything that can be done for a single general purpose application to affect the power consumption of the device it is running on? I am not familiar with how optimizations to individual ...
3
votes
1answer
1k views

Rails application - how to optimize/reduce database calls when iterating over a collection

What's the best way to optimize a Rails app where you need to pull info from the database for a collection of items? For example, if I am building an online forum system... I would have a number of ...
6
votes
1answer
328 views

Mobile cross-platform SDK for computationally intensive apps

I am aware of the PhoneGap toolkit for creating mobile applications for virtually all mobile platforms with a significant market share. However, the code in PhoneGap that is shared between the ...
2
votes
2answers
178 views

Better way to search for text in two columns

Here is the scenario. I am making a custom blogging software for my site. I am implementing a search feature. It's not very sophisticated - basically it just takes the search phrase entered and runs ...
4
votes
1answer
458 views

How to get experience in large scale databases?

I have written applications that are very small scale and the code I write works fine for them. But I have often wondered how the server side code I write would scale up from 100s of queries per day ...
4
votes
1answer
548 views

Research topics for starting and optimizing a high-traffic website

I bury a good deal of my ideas for fear that I don't know enough about scaling web applications and high-traffic websites. That said, I'd like to know of any general topics to research in order to ...
1
vote
1answer
380 views

Minimizing use of paper

I've recently faced this problem in a dynamic programming curriculum, and I honestly have no idea about how to determine the appropriate state. You're given N (1 <= N <= 70) paragraphs and M (1 ...
1
vote
3answers
3k views

Big O(n log n) and Quicksort number of operations

I have an Array with 1,000,000 unsorted elements. I need to calculate expected number of operations that needs to be performed to sort array using Quicksort algorithm in common situations (not the n^2 ...
1
vote
1answer
517 views

Optimize strategies for xml parsing?

I am looking for general optimization tips and guidelines for xml parsing. One of the optimization strategies is of course selecting the "right" parser. A detailed comparison between the available ...
72
votes
19answers
5k views

Is it ok to replace optimized code with readable code?

Sometimes you run into a situation where you have to extend/improve some existing code. You see that the old code is very lean, but it's also difficult to extend, and takes time to read. Is it a good ...
0
votes
1answer
276 views

FxCop / Code Analysis with VS2010 Ultimate

I've getting some information about this, but I still can find a proper answer, I was asked recently in my company for this : "run a fxcop analysis on that code and tell me the results". Ok, I have ...
7
votes
1answer
323 views

How fast should a web response be?

I've heard a few times that every extra [number1] milliseconds it takes to process a web request and return a response will lose you [number2] percent of users. Is this just "conventional wisdom," or ...
7
votes
6answers
2k views

Software Optimization vs. Hardware Optimization - what has the bigger impact?

I was wondering how software optimization and hardware optimization compare when it comes to the impact they have on speed and performance gains of computers. I have heard that improving software ...
3
votes
6answers
630 views

How do I determine if my code is optimized?

I am only developer working on a project. The functionality that I have coded works to expectations(desired result) but since I am the only one I don't know if I can do anything better to it. How do I ...
2
votes
1answer
92 views

File Processing Times

I have a very simple program in Ruby that opens a dictionary file, sorted-words.txt and prints out all the words in pig-latin. I tested its speed, and the first time I ran it, the program finished in ...
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
10k 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
3k 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, ...
6
votes
4answers
431 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
568 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
581 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
566 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
961 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
240 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
2k 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
93 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 ...
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 ...
4
votes
3answers
336 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
1k 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
640 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
706 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
107 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
451 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
163 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 ...
8
votes
9answers
1k 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
731 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
299 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
240 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
326 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
836 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 ...
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 ...