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
votes
1answer
32 views

Is denormalising a data structure essentially a code optimisation, to which the normal rules apply?

One of Bloch's Effective Java items 55: Optimize judiciously extends Jackson's rules on optimization: Rule no. 1: Don't optimise! Rule no. 2 (for experts): Don't optimise yet! Extra ...
0
votes
1answer
109 views

Approaching Particle Swarm Optimization with optimization problem, how to use PSO with it?

I am learning Particle Swarm Optimization. The problem is to find the pair of number whose sum is lowest. Lets say we have some numbers z1,z2,z3,z4 Number Value z1 -2 z2 -3 z3 3 ...
0
votes
0answers
76 views

Is anti-aliasing still relevant in a high resolution display? [migrated]

The idea of anti-aliasing is to make edges look smooth so it is nicer for human eye to see. But lately with the availability of high-resolution monitor, with high density per inch, which some called ...
0
votes
0answers
54 views

Decision making algorithm

I'm currently solving an optimisation problem of my own design, just to experiment and learn a little something. Here's the concept: I have a user that starts at home. The objective of this user is ...
-1
votes
0answers
29 views

Are methods on non-pointer types subject to optimization

I've been enjoying go for the last couple of weeks. I suspect that, having some background in C, the fact that Go has pointers triggers my being concerned with optimization. Probably overly so. When I ...
0
votes
1answer
110 views

Are there compilers which optimize the use of mathematical functions?

Today while programming I stumbled upon the following question - are there any compilers which optimize based on mathematical assumptions? For instance in cases like unsigned int i,b; (i,b not ...
0
votes
3answers
76 views

How to optimize iterable queries with external arguments

I will use C# here as an example, but my question is about any language. My question is from framework to compiler perspective (i.e the solution can be by implementing given idea inside compiler) ...
0
votes
2answers
146 views

Optimization problem where to start, what algorithms to use? [closed]

I have an optimization problem and I was wondering where to start from to be able resolve it. I think it can be solved with an NP-complete algorithm but I am not sure where to start from. The problem ...
2
votes
1answer
105 views

Improving sampling algorithm

I am having a bit of trouble designing a new feature at the moment. It is part of a resource management system. I was wondering if anyone has experience doing anything similar. I'll try to explain: ...
3
votes
3answers
74 views

What can qualify for potential tail call recursion (TCO) optimization or tail recursion elimination (TRE)

Short question is: what can qualify for potential tail call recursion optimization (TCO) or tail recursion elimination (TRE) if the compiler or interpreter supports it. The summary of this question ...
2
votes
0answers
78 views

Program to select N integers with constraints [closed]

I need to write a program which takes 4 inputs as follows N = The number of integers to be generated (10 < N < 10000) Start = The minimum value of the integers (100 < Start) End = The ...
2
votes
1answer
88 views

Maximizing Value and Volume, minimizing weight - Knapsack

Trying out a Knapsack variant where the rules are Any item you take must fit completely in the bag Usable metrics of the bag are length(l),width(w),height(h) and you can assume that if the products ...
3
votes
1answer
125 views

How to safely and cheaply delete a directory's contents that are constantly being deleted/overwritten

I'm coding something that will check a specific static location's directory, and if it exists, and a certain process has not run in n minutes, it deletes that directory's files and all sub-directory ...
4
votes
0answers
145 views

Combinatorial Optimization: Filling a Bag with Sand

I have an interesting "real-world" combinatorial optimization problem that I need to solve programmatically, however I have yet been able to whiteboard a good strategy. The task is similar to the ...
-1
votes
1answer
91 views

Sorting an array based on another array's order, quickly [closed]

There are two arrays of maps. The first array contains maps of ID values in a specific order (but not necessarily either pure ASC or DESC ordering): // pseudo code first := [ {"id": 1}, ...
0
votes
1answer
106 views

Optimization: How much time saved is considered worth it? [closed]

I was reading up about branch predictions and cache misses, and have decided to read what every programmer should know about memory. But I'm not sure how much low level knowledge do I need to have to ...
0
votes
1answer
64 views

Multiple variable assignment vs HashTable lookup

I'm writing a CUIT ( Coded UI Test ) and I'm replacing variables with data fetched from a csv. Example: this.UIMap.IDBParams.UITboxFsEditText = TestContext.DataRow["num_fs"].ToString(); ...
0
votes
1answer
97 views

storing single character value use string or int C# [closed]

While storing single character value for the purpose of status, gender, delete_flag etc. which is better data type string or int. Suppose :: status = A/I or status = 1/0 gender = M/F or gender = 1/0 ...
1
vote
2answers
174 views

Do nested conditionals have a significant performance impact? [duplicate]

This is a question that lives in my mind from a long time. Does the use of multiple nested conditional statements impact the performance of a taken code? So far I know that programmers have created a ...
2
votes
0answers
100 views

How to distribute the number of elements in a bucket so that it is Within a Range - Algorithm

I have been solving a problem where in say I have 50 elements n1, n2, n3, ... , n50 Now I have a limited number of buckets, say 5 buckets and the bucket can hold a range from , say 100 to 150 only ...
1
vote
0answers
40 views

Cost of cache coherency/sharing data across multiple cores?

If I have two CPU cores, one is writing a particular cache line and the other core wishes to Read Write the same cache line, what are the costs (in cycles) for doing so? I am a little unsure ...
3
votes
3answers
75 views

Premature memoization on obvious cases

In the code below there will be several instances of MainClass. class MainClass(object): def f(self, x): # expensive operations. # ... return 'something' Each instance ...
1
vote
3answers
2k views

Linking two or more different programming languages

I would like to ask how optimizer software written in C/C++ can be linked to simulator software written in FORTRAN or any other language. I have copied the section of journal article of Singh and ...
4
votes
2answers
83 views

How do you avoid dominant solutions in multi-objective simulated annealing?

Imagine an RPG game were you can cary N items, and you want to maximise your damage, attack speed and armour, given a set of items. I implemented simulated annealing where a permutation simply ...
0
votes
0answers
48 views

Microcontroller oLED Display Buffering Optimizations or Alternatives For Speed?

I'm developing a UI/Layout for a 128 x 64 oLED Monochrome Pixel Display. I've got a small netMF microcontroller driving the display via SPI at 40mhz. I'm using some basic methods, like these here, to ...
5
votes
5answers
294 views

Can a pimpl variation be implemented without any performance penalty?

One of the issues of pimpl is the performance penalty of using it (additional memory allocation, non-contiguous data members, additional indirections, etc..). I would like to propose a variation on ...
0
votes
1answer
80 views

Optimizing instant notifications

Scenario To deliver instant notifications to the client, I'm sending an AJAX request to a PHP page that checks if there are new notifications: if there are, it outputs them, otherwise it sleeps for ...
3
votes
1answer
105 views

Can fast, optimized server calls collapse a server?

I've followed a series of optimizations to make our APIs faster. We microoptimized a lot of PHP code to faster, native methods, we unsed variables where they were not being used anymore, and basically ...
9
votes
3answers
2k views

My algorithm that extracts the largest box that can be made from smaller boxes, is too slow

Imagine a cube based world (such as Minecraft, Trove, or Cube World) where everything is made up of identically sized cubes and all the cubes are of the same kind. The goal is to represent the world ...
3
votes
2answers
87 views

Reducing a sequence of array modification operations (insert, sort, replace, remove)

Given a plain array of values, e.g. ["Apple", "Orange", "Banana", "Strawberry"] and a list of operations from the set of [insert, delete, sort and replace], e.g. [ {cmd: "insert", index: 2, ...
3
votes
2answers
179 views

Work out which parcel deliveries we ship ourselves and which we outsource

Firstly, I hope I'm asking this in the right place. I work for a large online retailer in UK. We ship approaching 2000 orders each day and are growing very quickly. We currently use multiple delivery ...
0
votes
0answers
41 views

Approaches to combinatorial optimization problem

Problem I have the following combinatorial optimization problem: A set of applications need to be distributed among a set of nodes. Each node has a capacity and each application has a required ...
0
votes
0answers
25 views

Feasible solution on the constructions phase of GRASP

I am learning about the GRASP (Greedy Randomized Adaptive Search) meta-heuristics. From what I understood, GRASP is based on two main phases. The first one: Construct a initial solution based on ...
3
votes
1answer
72 views

Is serving a single document from a server to a browser slower than serving multiple documents?

I was looking into how to optimize web pages and the biggest way (code-wise) to optimize a website is to reduce the number of requests a browser has to make to your web server to get the full page. ...
6
votes
2answers
180 views

Algorithm for comparing hundreds of similar, but not identical documents

I have seen similar questions about text comparison, but none on such a large scale. I have a client with two sets of recordings of speeches, 250 and 550 recordings each. Each of the recordings in ...
2
votes
0answers
44 views

Optimizing trigram look ups with wildcards

I am working on creating a spell-checking service for Android (note: this is a platform- and language-neutral question) for Asturian, a minority Romance language. We're using hunspell as the base but ...
0
votes
0answers
108 views

Does loop unrolling on a JIT platfrom (.NET or JVM) provide any benefit

I know in C, you can use loop unrolling (unwinding) to help reduce branching in your code but at the expense of program size. That seems to work when you compile to a target machine, however, does it ...
13
votes
1answer
235 views

Why is Haskell unable to avoid repeated evaluation without the monomorphism restriction?

I just finished learnyouahaskell the other day, and I was trying to make sense of the Monomorphism Restriction, as described by the Haskell Wiki. I think I understand how the MR can prevent repeated ...
0
votes
0answers
242 views

Android runtime - does ART miss optimization opportunities over Dalvik?

Is ART a strict improvement over Dalvik, or there are optimizations that an ahead-of-time compiler will miss compared to JIT, but Google decide they don't matter in practice? For example, with JIT, ...
6
votes
6answers
695 views

performance versus reusability

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 ...
12
votes
2answers
554 views

Ant colony algorithm

I am a student working on an ant colony simulator for a course project. The algorithm for it is (obviously) an ant colony algorithm. I know there are various forms of the algorithm but all of those ...
1
vote
1answer
203 views

Different Implemenations of Tail Call Optimisation

I've heard some people in my university discuss the tail call optimisation in ML as if it were a special version tail call optimisation. Does the ML (SML/F#) implementations of tco in these languages ...
0
votes
0answers
60 views

How do we know how good a LLVM pass is?

Is there a set of benchmarks or some specific method to evaluate LLVM passes against a criteria, such as performance, memory usage, power consumption, etc? How do we know if the improvement proposed ...
18
votes
6answers
648 views

How does branch prediction work, if you still have to check for the conditions?

I was reading the popular answer about Branch Prediction from http://stackoverflow.com/q/11227809/555690, and there is something confusing me: If you guessed right, it continues on. If you ...
1
vote
1answer
410 views

How to merge two functions that do same things with different variables

I have these two Javascript functions that are equal except for the variables onClickVoteUp: function (e) { var $target = $(e.target); var upvoted = this.model.get("upvoted"); var ...
1
vote
2answers
172 views

Do today's modern compilers perform run time checks?

This is regarding compilers. Do compilers perform run time dependency checks to decide to vectorize a loop ? In other words, do compilers trace through the logic as it would in run-time to ...
1
vote
0answers
73 views

A fast algorithm for a simple multi-objective minimization?

I have a set of n (arbitrary) integer numbers S which I want to partition into k subsets S_i each of size n/k (you can assume that k divides n). Let A be the arithmetic mean of elements of the set S. ...
2
votes
0answers
68 views

Loop Unfolding and Named Significant Bits

I've been writing a Parser Compiler for the last seven or so years, and I recently got to the point (yet again, never satisfied) of structuring the portion dealing with the portions of the language ...
1
vote
2answers
103 views

When, if ever, are basic concurrency optimizations generally made?

Lets say I need to preform the following computationally intensive task For i in range(100000000): doComplexCalculationWithNoSideEffects(i) Most people I talk to tell me that basically any ...
2
votes
1answer
65 views

One Script file or Multiple Script Files [closed]

I have a moderately long(for me at least) bash script file that that maintains a list of LAN users and the bandwidth each one uses. It is 199 lines with 11 functions and is already calling 3 different ...