optimization

Simple 1-D particle swarm optimization algorithm for a noisy environment

I'm experimenting with particle swarm optimisation and am trying to determine the best approach for the following simple scenario: Optimizing a 1-dimensional function (i.e. particles are moving along a single line) The function to be optimised can be sampled at any point on the line The "value" sampled for each position is very noisy T...

C++: simple question about random number function

Possible Duplicate: Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7 I was asked a simple question (purely in interest), in it there's a function which supplies a random number between 1 and 6, now with based off that function you need to...

Are LINQ .Last, .Skip, etc. methods optimized for arrays or List<T>?

I'm wondering if LINQ methods like .Last and .Skip are optimized for arrays, List and the such. E.g. for an array I could do _array[_array.Length] to get the last element. Does _array.Last() actually enumerate through all elements and then return the last or is there actually some optimization built in? Might have to forgo fluency for p...

Optimization of Android Applications

Hello, I want to do optimization of my android application. Can anyone please tell what are different ways to optimize code and performance in android? I gone through one tool i.e. Zipalign: an Easy Optimization. Any other tools avaliable? Thank you. ...

how do you install memcache into your server?

sorry im a newbie, i dont know if i am asking the right question, i just wanted to optimise my sites perfomance!! thanks in advance ...

'optimize' attribute directive ignored

I have a project for which optimization has been set to "-Os" for all files via gcc command line flags. However, I want to disable optimization for some methods in one of the source files. To accomplish that, I am trying to specify the optimization attribute for those methods. However, gcc says that it is ignoring optimize attribute duri...

Are C/C++ compilers optimizing across compilation units?

Optimizations such as constant propagation are possible across functions within the same compilation unit (ie. same file). For example : int f(int x) { return 3 + x; } void main() { printf("%d", 1+f(4)); } In that example, I think that a sufficiently smart compiler can propagate the '4' constant to the function 'f', solving...

CSS "Normalizer" tool?

I need to maintain & improve an existing website and I am drowning in the redundancy I have discovered in its CSS stylesheet. Given the existing redundancy and non-methodlogical ordering of elements, it's hard to track and predict how a minor change will propagate through the system, or where to apply a change to achieve a certain effect...

How to optimize/refactor such code?

In the current project, there are lots of GetData() method, which get different kind of data from hand written database at run time, and set them in different fields in a class. The projects then have such methods. void GetData(Datatype type, int& value); void GetData(Datatype type, double& value); void GetData(Datatype type, long& valu...

BIT(1) vs ENUM('unknown', 'male', 'female') in MySQL

In performance terms, what will be faster, use a BIT(1) NULL (null = unknown, 0 = male, 1 = female) or ENUM('unknown', 'male', 'female') NOT NULL DEFAULT 'unknown' in MySQL MyISAM? Or this is considered micro-optimization? [EDIT] I think I'm going to use ENUM('male', 'female') DEFAULT NULL ...

Is there a performance penalty for storing values in the web.config compared to const fields?

Hello, currently in our application we have an ApplicationConfiguration class. It is basically just a static class with const values specifying certain application-global configuration options. Some of these values will rarely if ever change and are only put into the configuration for elegance/cleanness. Some of these values though do ...

Indexing on BigInt column in MySQL

i have a table which has big int column used for storing the time stamp.The time stamp value which we are getting from our application is 13 digit number like 1280505757693.And there are many rows in this table right now probably more than half a million entries.Should i use Index on timestamp column or not ???? Any suggestions ? ...

performance tuning for JSF

Can any one list out the tips to tune JSF WebApp @ its best. ...

I am creating a program to implement Sieve of Eratosthenes in C++ for Codechef. But i need a way to optimize the program for large inputs (10^9)

#include <iostream> #include<map> using namespace std; map <long long , long long> h; void sieve(long long start,long long size) { long long i,j; for (i=2; i*i <= size; i++) { if (!h[i]) { for(j = i+i; j < size ;j+=i) { h[j] = 1; } } } for (i=2; i<size; i++) { if (!h[...

how do I make my application as fast as windows explorer for rendering files.

I have a folder with a large amount of files inside of it. I want to be able to render each of my files as a button. And when I click on the button something will happen. private void Form1_Load(object sender, EventArgs e) { int x = 10; int y = 10; /// Process the list of files found in the directory. ...

iPhone : how to bring up the UI faster?

I'm currently developing a client similar to twitter. The app has 5 tabs, and are all table views controllers. It seems simple enough, but the start up time (from hitting the app on the menu..to the black screen+status bar ...to the user interface) is 18 seconds! I want to slice this down to at least 5-6 seconds and don't want to have ...

CSS child vs descendent selector

Somewhere I read that using the child selector (>) in css is faster than the descendant selector ( ). For example: 'p > em' as opposed to 'p em'. [I'll look for the reference]. It seems to me that the majority of code I see in the wild does not take advantage of this. I understand that certain circumstances would merit the use of one...

How could I optimize the XPath test not(previous-sibling::sect1) for testing whether this is the first sect1 child element?

I'm developing an XSLT 1.0 stylesheet (and apply it using xsltproc). One of the templates in my script should perform some special handling for the first <sect1> element in a given parent node and some for the last <sect1> element. Right now this special handling is implemented like this: <xsl:template match="sect1"> <xsl:if test="not...

Optimizing simple usage of Linq in C#

Hi, I have replicated a stripped-down version of my code that has recently been re-written to use linq to access the database. However, in my opinion, the linq is really simple and could probably be optimized quite a bit, especially around line 90 where there is a linq statement inside a foreach loop. It'd be really helpful to see how...

Process optimization for large sets of data

I currently have a project where we are dealing with 30million+ keywords for PPC advertising. We maintain these lists in Oracle. There are times where we need to remove certain keywords from the list. The process includes various match-type policies to determine if the keywords should be removed: EXACT: WHERE keyword = '{term}' CONTAIN...