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
2answers
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 ...
0
votes
0answers
22 views

Why does this code take up so much memory? [migrated]

I created a solution to this problem on leetcode: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes ...
4
votes
1answer
60 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
23 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 ...
4
votes
3answers
130 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
0answers
41 views

Encrypted values (mcrypt_encrypt) in URL parameters generating different results while requesting.How to tackle the situation? [migrated]

I am using the following function to encrypt a string ($str) using a key ($key) to make a unique key. Sample Code: <?php $key = "####"; $str = "123456789"; $encrypted_key = ...
0
votes
1answer
53 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
94 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
58 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
123 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
36 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
21 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
63 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
145 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
34 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
66 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 ...
12
votes
1answer
191 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
112 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
652 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
483 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
186 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
49 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
598 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
285 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
155 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
68 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
65 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
94 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 ...
1
vote
1answer
57 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 ...
1
vote
2answers
80 views

Should benchmarks (to compare processors performance) be compiled with optimization CFLAGS?

I need to compare performance of 2 processors and I concluded I should benchmark then with several various tests. I'm currently using linpack (HPL) (because it's still well known and used for ...
3
votes
2answers
127 views

get All data vs get partial data Optimization

Let's say a client makes a GET call to the server to get all the followers of some user. now the client shows a list of all the followers but the only data the list needs is: {"username" : "user", ...
3
votes
1answer
110 views

Deciding How To Split Up Architecture Using If Blocks

I'm having trouble deciding the best way to handle splitting up if block checks for different architectures. I may be handling the scenario completely wrong, so let me know if that is the case, or if ...
1
vote
1answer
282 views

In C#, performance wise, an object's size does matter when you access one of its members through a reference?

It may be a stupid question but in C#, performance wise, an object's size or complexity does matter when you access one of its members through a reference? Or only that specific member is all that ...
1
vote
2answers
223 views

When should we work on GC optimization?

So, I've learnt about how GC works and how can I monitor it via VisualVM, but my question is about why we should ever perform GC optimization? In our web project (JSF/Spring/Hibernate) we haven't ...
8
votes
4answers
441 views

Maintenance cost of SIMD programming code base

Question: The software industry's consensus is that clean and simple code is fundamental to the long-term viability of the code base and the organization that owns it. These properties lead to lower ...
2
votes
3answers
149 views

Best approach for storing huge data

I'll be handling 300,000+ users. Each user (after logging in) will be able to create lets say "folders", in each folder, users will create "name=value,name2=value2,name3=value3" entry pairs. Each name ...
0
votes
1answer
1k views

Designing a scalable schema for college database [closed]

I am trying to build back end for college ERP system. The system will be based on LAMP. These is the scenario: Colleges have 5 branches There are 4-6 classes in each branch. There are 80 students ...
1
vote
0answers
165 views

Algorithm for sport tournament bracket tree

I would like to develop a library that: receive n players in input response with the tournaments brackets in output. I would ask you what kind of algorithm I have to use to choose the correct tree ...
1
vote
0answers
87 views

Multiple API Calls on Web Server

I am trying to build a Tumblr Site that makes API calls to Social Network sites and return data and render on the Tumblr Site. And the thing is Tumblr doesn't allow PHP on their HTML Editor. So my ...
2
votes
2answers
182 views

Do we really need auto-vectorization?

I am trying to understand automatic parallelization and a special case of that is auto vectorization. As I understand it auto-vectorization is more or less: The compiler takes parts of the code which ...
2
votes
1answer
353 views

Quickest sorting algorithm for sorting a low number of integers

I am making a program on my spare time that I want to run as quickly as possible. The program is written in C. A large set of the procedures operate on pointers to 7 integers that are sorted by their ...
2
votes
2answers
207 views

How can I get better than O(N^2) space complexity for a type sequence search?

Suppose I have a type sequence through which I want to search: template <typename...> struct TypeSequence { using type = TypeSequence; }; I want to create a metafunction Search that returns ...
3
votes
1answer
53 views

How to diversify an optimal solution set?

If given a list of players, their salaries, and their projections, one can easily find the top 'n' projected teams (where a team is a combination of players), such that every team is under the salary ...
-1
votes
2answers
241 views

Does GCC optimize code to remove useless variable read operations? [closed]

I'm using GCC on ununtu 14.04. My program is written in c++ and in a case i need to check the amount of time the program needs to read a large integer array. what is the best way to do this without ...
2
votes
1answer
331 views

Do compilers un-inline recurrent expressions?

Does a compiler look for recurrent expressions to convert it into 'function' to reduce binary size and improve performance? Of course, the obvious answer might be "some do it, some don't", so I ask ...
0
votes
0answers
99 views

What Algorithm can be use for task allocation based on location?

What algorithm can be use for task scheduling based on location? For example there are 100 students and 5 lecturers available. Each lecturer must get same amount of student using location allocation ...
1
vote
2answers
678 views

Calculating NPath Complexity

I'm trying to calculate the NPath Complexity within a function, but I'm unsure what parts I count. My understanding is that it'll sum: If Else Else If Switch Case Default Do While Is this ...
4
votes
1answer
694 views

How do I add link-time optimization capabilities to my LLVM-based compiler?

I am designing and implementing a programming language, and I am using LLVM for native code generation. Among others, performance is a key feature of the language, and as such, I am looking to ...
7
votes
6answers
1k views

Why don't compilers inline everything? [closed]

Sometimes compilers inline function calls. That means that they move the code of the called function into the calling function. This makes things slightly faster because there's no need to push and ...