optimization

Wordpress static pages 'SEO' ?

Good Day! I have a photostudio site running on a Wordpress. It's have a blog and a bunch of static pages. In blog we post some news and the static pages contains info about our services. We have idea to add some relevant URLs from our blog to those static pages. The links would be acquired from our blog by Wordpress Related Posts plugi...

YUI Compressor and .NET Apps

I want to use YUI Compressor (the original) and use it as part of typical MS build processes (Visual Studio 2008, MSBuild). Does anyone have any guidance or thoughts on this? For example, good ways for incorporating into project, what to do with existing CSS and JS references, and the like. I am happy to hear on the benefits of YUI Com...

Increasing Speed

A broad question I know but: Does anyone have general tips on increasing execution speed in Fortran programs? ...

How to optimize mysql date_format() for speed in where clause?

Hi guys, I'm trying to optimize relatively big mysql (myisam) table with 220,000 rows. The table itself is not so big - about 23.5MB in size. So, what's the real problem? - i got query like this: SELECT * FROM table WHERE DATE_FORMAT(date_field, '%m%d') = '1128' LIMIT 10 I tried to set an index on date_field but EXPLAIN show that the ...

Tree iterator, can you optimize this any further?

As a follow up to my original question about a small piece of this code I decided to ask a follow up to see if you can do better then what we came up with so far. The code below iterates over a binary tree (left/right = child/next ). I do believe there is room for one less conditional in here (the down boolean). The fastest answer wins!...

Speed up a UPDATE with SELECT query

I have two tables: Table 1 has Episode and Code, with Episode as distinct. Table 2 has Episode and Code, but Episode is not distinct (other fields in the table, not relevant to the task, make each row unique). I want to copy Table 1's Code across to Table 2 for each episode. The current code to do this is as follows: UPDATE Table2 SE...

How to know which optimizations are turned on in gcc ?

Hi, I've seen that you can see the optimizations which are turned on using: gcc -O2 -Q --help=optimizers but the thing is that it only shows optimizations that have a flag. Do you know if there's a way to find the others ? This is maybe stupid since with no flag how would they describe the optimizations...but anyway... ...

Which is better/more efficient: check for bad values or catch Exceptions in Java

Which is more efficient in Java: to check for bad values to prevent exceptions or let the exceptions happen and catch them? Here are two blocks of sample code to illustrate this difference: void doSomething(type value1) { ResultType result = genericError; if (value1 == badvalue || value1 == badvalue2 || ...) { resul...

Pearson Similarity Score, how can I optimise this further?

I have an implemented of Pearson's Similarity score for comparing two dictionaries of values. More time is spent in this method than anywhere else (potentially many millions of calls), so this is clearly the critical method to optimise. Even the slightest optimisation could have a big impact on my code, so I'm keen to explore even the s...

Fast string to integer conversion in Python

A simple problem, really: you have one billion (1e+9) unsigned 32-bit integers stored as decimal ASCII strings in a TSV (tab-separated values) file. Conversion using int() is horribly slow compared to other tools working on the same dataset. Why? And more importantly: how to make it faster? Therefore the question: what is the fastest wa...

What does "built-in method decode" mean in Python when profiling?

I'm trying to make my program faster, so I'm profiling it. Right now the top reason is: 566 1.780 0.003 1.780 0.003 (built-in method decode) What is this exactly? I never call 'decode' anywhere in my code. It reads text files, but I don't believe they are unicode-encoded. ...

Algorithm for multidimensional optimization / root-finding / something

I have five values, A, B, C, D and E. Given the constraint A + B + C + D + E = 1, and five functions F(A), F(B), F(C), F(D), F(E), I need to solve for A through E such that F(A) = F(B) = F(C) = F(D) = F(E). What's the best algorithm/approach to use for this? I don't care if I have to write it myself, I would just like to know where to...

Where is the best place to put cache-evicting logic in an AppEngine application?

I've written an application for Google AppEngine, and I'd like to make use of the memcache API to cut down on per-request CPU time. I've profiled the application and found that a large chunk of the CPU time is in template rendering and API calls to the datastore, and after chatting with a co-worker I jumped (perhaps a bit early?) to the ...

return by value inline functions

I'm implementing some math types and I want to optimize the operators to minimize the amount of memory created, destroyed, and copied. To demonstrate I'll show you part of my Quaternion implementation. class Quaternion { public: double w,x,y,z; ... Quaternion operator+(const Quaternion &other) const; } I want to know how...

Optimizing paging between ImageViews in Android?

Hello, everyone, For the application I'm currently working on, I created something like ImageSwitcher for multiple images (imagine iPhone's UIScrollView with paging enabled). At first, I hardcoded some ImageViews and loaded their drawable resources on creation/inflation, but after some tweaks (and what I thought were improvements), I r...

Is optimization and generating debug info part of compilation or linkage

I am reading a Makefile from someone else as follows. LDFLAGS=-lm -ljpeg -lpng ifeq ($(DEBUG),yes) OPTIMIZE_FLAG = -ggdb3 -DDEBUG -fno-omit-frame-pointer else OPTIMIZE_FLAG = -ggdb3 -O3 endif CXXFLAGS = -Wall $(OPTIMIZE_FLAG) all: test test: test.o source1.o source2.o $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) M...

Memory usage of iterators in C#

What is the impact on memory usage of using lots of iterators in C#? Let's assume a program that performs thousands of foreach loops -- does each loop allocate a temporary object on the heap via a call to GetEnumerator? Does the CLR perform any kind of optimization (e.g. stack allocation of IEnumerator objects)? Or is this simply not ...

How to reduce Scala (/ Java) startup overhead?

I'm pretty ignorant of the Java world (I do mostly C / Python) but Scala looked interesting enough to pull me in. One problem I'm having with it is the enormous startup overhead - 0.3 seconds minimum, much more if I'm using the interpreter instead of compiling, compared to effectively 0 for Python or C. So even though the language is ten...

Optimization Suggestions for Javascript.

here is the code....: var minX = minY = maxX = maxY = 0; for(var i=0; i<objArray.length; i++){ if(objArray[i].x < minX){ minX = objArray[i].x; }else if(objArray [i].x > maxX){ maxX = objArray[i].x; } if(objArray[i].y < minY){ minY = objArray[i].y; }else if(objArray [i].y > maxY){ maxY = objArray[i].y; } } I...

What is the most efficient way to add an element to a list only if isn't there yet?

I have the following code in Python: def point_to_index(point): if point not in points: points.append(point) return points.index(point) This code is awfully inefficient, especially since I expect points to grow to hold a few million elements. If the point isn't in the list, I traverse the list 3 times: look for it a...