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
votes
0answers
13 views

code time out at some value of n [on hold]

let us consider following code function [aic_matrix,bic_matrix]=ARMA_model(y,n); %n possible order of each model LOGL = zeros(n,n); %Initialize PQ = zeros(n,n); for p = 1:n for q = 1:p ...
0
votes
2answers
101 views

Is it fine to reuse a class instance?

I ask in terms of high cost classes, with a particle engine as an example. I read somewhere that an instance of a class with a high cost to initialize, like a particle manager, should have its state ...
-1
votes
1answer
26 views

What category of workloads/problems would best suit learning about C/Linux Optimisation and distributed systems/HPC? [closed]

I've got a bunch of spare hardware and I'm really fascinated in optimising C code and Linux, while also working with distributed systems. To do this, I'm keen to start coding distributed solvers for ...
0
votes
2answers
64 views

Trying to “combine” similar objects without doing a bazillion comparisons

In this database I have "accesses" - each access can have any number (usually less than 4, sometimes as many as 15) attributes. I also have "tickets" where N users are requesting M accesses, so I've ...
-3
votes
0answers
66 views

Boolean || optimization [migrated]

I'm just trying to optimize some code (From a beginners stand point). I have options passed into a function and I want to determine whether a variable is defined in the options object and set it ... ...
0
votes
0answers
28 views

Maximize the visibility of an ad to a maximum of people in an automatic advertising system

I have N different ads that I want to display at the same time to M people in an automatic advertising system. Some people will never see some ads because they only check some specific criteria on the ...
2
votes
0answers
43 views

Performance consideration and code reduction for Templates

I'm trying to decide if this might be a good idea to help reduce the size of some of my xaml resource dictionaries on a large project. Except I'm concerned about any potential performance issues going ...
2
votes
3answers
90 views

Difference between Optimization and Scalability?

If I quote a paragraph from Wikipedia about Optimization: In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of ...
0
votes
0answers
20 views

Request size sweet spot?

In a client-server situation, a way to batch requests to the server, ideally to batch all requests for one page (on page load), to get the entire model view for the page and all resources in one HTTP ...
17
votes
9answers
1k views

Does OO, TDD, and Refactoring to Smaller Functions affect Speed of Code?

In Computer Science field, I have noticed a notable shift in thinking when it comes to programming. The advice as it stands now is write smaller, more testable code refactor existing code into ...
1
vote
0answers
80 views

How to identify performance bottlenecks in your software [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 ...
2
votes
2answers
147 views

Implementing bussiness logic with a large number of business rules and processes

We are currently working on a project that heavily relies on a database. Among many tables the main focus is on table "data" which is linked to another table "data_type" as many-to-one, which is then ...
0
votes
1answer
105 views

Mixing declarative & imperative code (Implicit 'unit tests' ?) [closed]

Well I'm no expert, but as a student, I'm curious about languages and their design patterns / goals. I'd like to know, whether there are any points I miss in the following examples, and why ...
1
vote
1answer
155 views

modelling a restaurant availability search

I am looking into finding an efficient way which can scale up to thousands of restaurants, for doing a reservation search. Ideally, it would be efficient to answer queries like find a restaurant ...
1
vote
1answer
131 views

Measuring “novelty” of data

I have a heuristic in mind that should allow me to "score" data based on "novelty" that I would like to work in real-ish time. In this case, I mean novelty in the sense that the data source is ...
1
vote
1answer
185 views

Next power of 2 for a number (in search for better “bit-twiddling” way)

I just wonder if there exists better (i.e. faster?) way to get the next power of 2 for a given number than the following one (maybe some better sort of "bit-twiddling" hack is possible?) ... static ...
5
votes
4answers
815 views

How do I traverse a tree without using recursion?

I have a very large in memory node tree and need to traverse the tree. Passing the returned values of each child node to their parent node. This has to be done until all the nodes have their data ...
0
votes
3answers
382 views

Unique and primary keys on a database (mysql)

I'm having quite some doubts here... If I have a table related to username/password login how can I assure there won't be any more matches of the same username and password in the same table using ...
14
votes
2answers
375 views

Algorithm for fast tag search

The problem is the following. There's a set of simple entities E, each one having a set of tags T attached. Each entity might have an arbitrary number of tags. Total number of entities is near 100 ...
0
votes
2answers
156 views

Multi regex matching — what to do to optimize it?

I have multiple regexes matching an input in greedy-first mode. All regexes are already compiled and I don't see what I can do more to speed-up things. I mean using tools coming with .Net framework. ...
3
votes
1answer
260 views

Compiler doesn't inline anything?

I've rolled my own SIMD-accelerated math library. It's gotten pretty complete, so naturally I went to conduct speed tests and optimize it. Btw this isn't premature optimization, the lib is actually ...
2
votes
0answers
134 views

Understanding velocity update in Binary Particle Swarm Optimization

I am wondering how to interpret the velocity update in a Binary Particle Swarm Optimization (PSO). To recap the velocity update : V(t+1) = V(t) + c1 * r1 * (XlocalBest - X(t)) + c2 * ...
3
votes
3answers
574 views

Ordering if conditions for efficiency and clean code [closed]

This is purely a design question and the example is simple to illustrate what I am asking and there are too many permutations of more complex code to provide examples that would cover the topic. I am ...
0
votes
1answer
146 views

What are some efficient ways to set up my environment when working on a remote site?

Hello fellow Programmers, I am still a relatively new programmer and have recently gotten my first on-campus programming position. I am the sole dev responsible for 8 domains as well as 3 small sized ...
1
vote
1answer
100 views

Optimising news fetching

I have a web scraper for scraping news from different sources in wp7. My current appraoch for doing this is: load newspapers information from xml file. go to the specified sections and fetch the ...
0
votes
1answer
207 views

How small is the footprint of a small C compiler?

This week I could optimize using a reduced C library that allowed a drastic shrinkage in code size - from about 60 K to about 6 K and then we could load the code in the 8 K on-chip memory of an FPGA ...
4
votes
2answers
218 views

Optimizing code generation for expressions in a compiler

I don't know if this question has a simple answer or not, but I just have to ask. I'm reading this tutorial (I don't know if this is a well-known series, but it's name is 'Let's build a compiler!' by ...
5
votes
2answers
417 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 ...
7
votes
4answers
726 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 ...
3
votes
1answer
279 views

Does setting a function public affect the C# compiler's ability to inline the function as an optimization?

This could be either for the .NET or Mono compilers. I know that under certain conditions the compiler can inline functions (e.g. small, single call site, etc.) as an optimization. However, if the ...
1
vote
1answer
124 views

Optimization of time-varying parameters

I need to find an optimal set of "n" parameter values that minimize an objective function (a 2-hr simulation of a system). I have looked at genetic algorithm and simulated annealing methods, but was ...
-4
votes
4answers
221 views

Which if statement requires less computation?

I have if (!b && c || a && c) //do action a else //... Due to some internal relationship between a, b, and c. !b && c || a && c is proved to be equivalent to (! ...
3
votes
1answer
142 views

Algorithm to arrange objects so that the total length of edges between them is minimized?

We are given a list of edges between a set of N vertices. There are atmost three edges joining a vertex. We have to arrange all the vertices on a straight line with the positions numbered from 1 to N ...
0
votes
2answers
302 views

What is the exact syntax of inline?

CASE 1 (Definition and declaration in same source file) Suppose both my prototype and definition of global function is in .cpp file. Where should I write inline keyword to make compiler know? In ...
1
vote
1answer
200 views

What are some algorithms that can assist with reservation time scheduling?

Here's the gist of the problem: There are multiple service providers who each have their own schedules of availability. There are multiple customers who seek their services. Customers need to be able ...
1
vote
4answers
148 views

Efficient way of evaluating an array of strings then add to an array in Ruby

I am looking for an efficient way of evaluating an array of strings against a series of rules and then adding them to another array. For example I have an array of strings: something a 1234 #gohere ...
2
votes
1answer
389 views

Benefits of setting PHP memory_limit to lower value for specific PHP script?

I need to execute just few lines of PHP code on every single page of my website. This PHP code does not require more than 4MB memory. That is why i want to allocate just 4MB memory to all pages by ...
3
votes
5answers
245 views

Premature optimization in deciding how to optimize?

We have a class that has been properly identified for optimization. We've done the profiling and testing, and it's a problem. Now we have two possible approaches for optimizing this class: There is ...
3
votes
3answers
142 views

Are there algorithims for polling optimization?

I have a web-application with an async HTTP backend, which gets called by the client by AJAX requests. The client has to start a job and then polls for the result. I started with a simple 150ms ...
0
votes
1answer
305 views

Sum of divisors of numbers of the range ~ 10^6

I was trying to find the sum of divisors of numbers upto 106. The test cases are like of the order of 105. I have done some pre processing like int divisors(int num) { int sum=0; for(int ...
10
votes
6answers
309 views

When to start thinking about scalability?

I'm having a funny but also terrible problem. I'm about to launch a new (iPhone) app. It's a turn-based multiplayer game running on my own custom backend. But I'm afraid to launch. For some reason, I ...
0
votes
1answer
260 views

Python — Time complexity of built-in functions versus manually-built functions in finite fields

Generally, I'm wondering about the advantages versus disadvantages of using the built-in arithmetic functions versus rolling your own in Python. Specifically, I'm taking in GF(2) finite field ...
5
votes
2answers
289 views

Structuring Access Control In Hierarchical Object Graph

I have a Folder entity that can be Moderated by users. Folders can contain other folders. So I may have a structure like this: Folder 1 Folder 2 Folder 3 Folder 4 I have to ...
3
votes
2answers
1k views

Are unused CSS rules so costly that they must be removed?

I have been reading various Web application optimizing articles and many of them suggest to remove unused CSS rules. Currently, I have a page which has jQueryUI css, Bootstrap CSS, Datatables CSS and ...
7
votes
3answers
337 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.
0
votes
4answers
122 views

Use functions inside a loop declaration

What's the best practice? This : for ($i = 0; $i < count($array); $i++) { //stuff } Or, what I usually do : $count = count($array); for($i = 0; $i < $count; $i++) { //stuff } Is it the ...
2
votes
2answers
108 views

Find common functionalities or functions between 2 programs

I've been facing a problem recently, in which I want to optimize two programs. For that, I wanted to create some kind of "Common Interface" which I could reuse between my two programs. However, the ...
1
vote
0answers
240 views

Optimization algorithm, how to develop this problem

I have a situation where I would like your input and think over / solve algorithm. The specs There are inventories with a specified amount of capacity. 'X (width) and Y (time)' creates ...
11
votes
6answers
901 views

Jargon to describe unnecessary running of code? [closed]

Some code works but it runs an unnecessarily large fraction of the code in many cases, though that extra code is still required sometimes. Better preprocessing, simple stoppers and conditional ...
1
vote
4answers
240 views

Write then optimise or write optimised [duplicate]

Do you write your code then optimise it? Or do you write an optimised code from the beginning. I always believe in writing optimised since I really dont like to rewrite code, But please share your ...