optimization

SQL - Optimizing complex paged search querys

Hi, I'm currently developing a stored procedure for a complex search in a big database. Because there are many thousand entries, that could be returned I want to use paging. Although it is working, I think it's too slow. I read a lot of posts and articles regarding pagination of SQL queries and optimizing performance. But most 'optimizat...

GCC special optimization options for double precision floating point arithmetics

Do you know which of the GCC optimization flags are the most appropriate to build an application, which uses double floating point and calculates a lot in real-time and it uses -lm. A target hardware is two Dual-Xeons with Linux on-board. Thanks in advance! ...

When optimizing database queries, what exactly is the relationship between number of queries and size of queries?

To optimize application speed, everyone always advises to minimize the number of queries an application makes to the database, consolidating them into fewer queries that retrieve more wherever possible. However, this also always comes with the caution that data transferred is still data transferred, and just because you are making fewer...

How can I further optimize this color difference function?

I have made this function to calculate color differences in the CIE Lab colorspace, but it lacks speed. Since I'm not a Java expert, I wonder if any Java guru around has some tips that can improve the speed here. The code is based on the matlab function mentioned in the comment block. /** * Compute the CIEDE2000 color-difference betwe...

sql-server performance optimization by removing print statements

We're going through a round of sql-server stored procedure optimizations. The one recommendation we've found that clearly applies for us is 'SET NOCOUNT ON' at the top of each procedure. (Yes, I've seen the posts that point out issues with this depending on what client objects you run the stored procedures from but these are not issues...

Will the compiler optimize escaping an inner loop?

The code I have looks like this (all uses of done shown): bool done = false; for(int i = 0; i < big; i++) { ... for(int j = 0; j < wow; j++) { ... if(foo(i,j)) { done = true; break; } ... } if(done) break; ... } will any compilers convert it to this: for(int i = 0; i < big; i++) { ... ...

To create new DB connection or not?

I'm running a cron job (every 15 minutes) which takes about a minute to execute. It makes lots of API calls and stores data to the database. Right now I create a mysql connection at the beginning and use the same connection through out the code. Most of the time is spent making the API calls. Will it be more efficient to create a new...

How to optimize mysql database automatically in PHP?

i have a database and need to automatically optimize this 24 hourly What should I do? ...

mysql queries - performance loss by putting numbers in quotes?

If a variable will always be a number, is there a performace loss by putting it in inverted commas? for example "SELECT prod.product_name FROM prod WHERE prod.id = '$id'"; ...

Jqgrid 3.7 does not show rows in internet explorer

I'm testing with ASP.NET and Jqgrid 3.7, in firefox it works fine but in IE it does not show any row in the grid. The response from the webservice is {"d": {"__type":"jqGrid", "total":"1", "page":"1", "records":"10", "rows":[ {"id":"180","cell":["180","Cultura"]}, {"id":"61","cell":["61","Depor...

Mysql advanced SELECT, or multiple SELECTS? Movies keywords

I have a mysql database with movies as follows: MOVIES(id,title) KEYWORDS_TABLE(id,key_id) [id is referenced to movies.id, key_id is refernced to keywords.id] KEYWORDS(id,keyword) //this doesn't matter on my example.. Basically i have movies with their titles and plot keywords for each one, i want to select all movies...

is there any faster way to parse than by walk each byte?

is there any faster way to parse a text than by walk each byte of the text? I wonder if there is any special CPU (x86/x64) instruction for string operation that is used by string library, that somehow used to optimize the parsing routine. for example instruction like finding a token in a string that could be run by hardware instead of...

Reflector error or optimisation?

Long story short: I used reflector on the System.Security.Util.Tokenizer class, and there's loads of goto statements in there. Here's a brief example snippet: Label_0026: if (this._inSavedCharacter != -1) { num = this._inSavedCharacter; this._inSavedCharacter = -1; } else ...

Reducing permutations of many nested loops

I decided to do an image to explain this better, I just want to check my thinking is ok, and that I can reduce total permutations by 75%: ...

jQuery - Multiple selectors & multiple values in ONE call

Hi, I was wondering whether there's a way of using multiple selectors in jQuery and setting different values for them IN ONE CALL. E.g.: $(selector1, selector2, selector3, ...).css({left:[532, 112, 453, ...]}); Thanks in advance Edited: Just to be clear you can only call .css once. Is it possible? Edited again to clarify: I'm aski...

PHP speed optimisation.

Hi, Im wondering about speed optimization in PHP. I have a series of files that are requested every page load. On average there are 20 files. Each file must be read an parsed if they have changed. And this is excluding that standard files required for a web page (HTML, CSS, images, etc). EG -> client requests page -> server outputs ht...

Movies recommendation engine conceptual database design

I am working at an movie recommendations engine and i'm facing a DB design issue. My actual database looks like this: MOVIES [ID,TITLE] KEYWORDS_TABLE [ID,KEY_ID] where ID is Foreign Key for MOVIES.id and KEY_ID is a key for a text keywords table This is not the entire DB, but i showed here what's important for my problem. I have...

Strange: Planner takes decision with lower cost, but (very) query long runtime

Facts: PGSQL 8.4.2, Linux I make use of table inheritance Each Table contains 3 million rows Indexes on joining columns are set Table statistics (analyze, vacuum analyze) are up-to-date Only used table is "node" with varios partitioned sub-tables Recursive query (pg >= 8.4) Now here is the explained query: WITH RECURSIVE ...

jQuery link nudge and color transform

Hey everyone, I have achieved the effect described in the title using the following code: $(document).ready(function(){ $('.button').mousedown(function() { $(this).animate({ 'top': '3px' }, 70); }); $('.button').mouseup(function() { $(this).animate({ 'top': '0px' }, 70); }); $('.button').hover(function() { $(this).stop().an...

Why is Postgres doing a Hash in this query?

I have two tables: A and P. I want to get information out of all rows in A whose id is in a temporary table I created, tmp_ids. However, there is additional information about A in the P table, foo, and I want to get this info as well. I have the following query: SELECT A.H_id AS hid, A.id AS aid, P.foo, A.pos, A.size FROM ...