optimization

Optimizing MySQL queries with IN operator

I have a MySQL database with a fairly large table where the products are. Each of them has its own id and categoryId field where there is a category id belongs to this product. Now I have a query that pulls out products from given categories such as: SELECT * FROM products WHERE categoryId IN ( 1, 2, 3, 4, 5, 34, 6, 7, 8, 9, 10, 11, 12 ...

How to prioritise certain queries in MySQL?

I have a large number of background reads and writes, and a much smaller number of user reads, of a highly contended MySQL database - is there any way to flag certain queries (the user queries) as being high priority so that they take preference over background queries? I want user responsiveness to be high, but don't really care about t...

.net Compiler Optimizations

I am writing an application that I need to run at incredibly low processor speeds. The application creates and destroys memory in creative ways throughout its run, and it works just fine. I am wondering what compiler optimizations occur so I can try to build to that. One trick off hand is that the CLR handles arrays much faster than list...

What is tail recursion optimization?

Possible Duplicate: What is tail-recursion? What is tail recursion optimization? ...

Preventing code replication in javascript by combining these functions

So I have two jquery functions that bassically do the same, but on 2 seperate containers. Is there a way to combine these two functions. $('#autobid-list .auction-button').click( function(){ if($(this).attr('summary') == 'autobid-button'){ $(this).parents('li').addClass('none'); }else if($(this).attr('sum...

Search Engine Optimization

Hi Guys, My neighbour popped over last night to ask me for help with regards to his company's website. He said that it used to be ranked pretty high on Google but has since fallen off completely. Now, I'm a Windows App programmer hence my request for help. I took a look and there the meta tags seem ok. I recommended that he add a <h1>h...

How many PHP includes are too many?

Each page on my website is rendered using PHP. Each PHP file uses around 10 includes. So for every page that is displayed, the server needs to fetch 10 files, in addition to the rest of it's functions (MySQL etc). Should I combine them into a single include file? Will that make ANY difference to real world speed? It's not a trivial tas...

In Javascript/jQuery, is there a difference in rendering performance if I condense my code into "one-liners"?

Is there a difference in performance (I am not asking about readability) if I condense my code into one line versus two? For example: var slide = 'images/' + n + '.png'; $('img').attr('src',slide); versus $('img').attr('src','images/' + n + '.png'); Personally, I like fewer lines of code. Often, I am the only one reading my co...

How would you go about improving MySQL throughput in this simple scenario?

I have a relatively simple object model: ParentObject Collection<ChildObject1> ChildObject2 The MySQL operation when saving this object model does the following: Update the ParentObject Delete all previous items from the ChildObject1 table (about 10 rows) Insert all new ChildObject1 (again, about 10 rows) Insert ChildObject2...

Is it better to swap classes or swap content in jQuery

I was wondering which of these two scenario's works best for swapping between 2 stated. Let's say for temporary disable a button. I think the first and most easy way is just to have both pieces of html already in place. And when clicked the a class of none is swapped, like this: css: .none{display:none;} html init: <div class"somecss ...

jQuery: Hogging resources - firebug Time and Profile disagree on time.

Hi All, I have a few hundred lines of jQuery code that pull a list of items and subitems from a database, build a series of divs to display them, and add them to a list. I can show the code if necessary, though I can't imagine anyone will want to slog through it all, but the issue I am having is that one of my functions is taking about...

MySQL: Indexing large amount of columns with varied queries

Hey guys.... I really hope someone can help me here as I can't seem to get an answer anywhere :( Basically I'm working on a large table so indexes are pretty important, but it's basically a table that has several different fields that are searchable..... so the way the columns are queried has probably 100's of different variations, so c...

speeding up website load using multiple servers/domains

When Yahoo! developer guide says "Deploying your content across multiple, geographically dispersed servers will make your pages load faster from the user's perspective". And as an explanation I read somewhere, that browsers will load up to 5 things simultaneously from the same domain. Would a subdomain, for example cdn.example.com be ...

Php array_push() vs myArray[]

If I understood properly you can add value to an array by using : $myArray[] = 123; or array_push($myArray, 123); Is one cleaner/faster then the other one ? ...

Completely remove ViewState for specific pages

Hi everybody, I have a site that features some pages which do not require any post-back functionality. They simply display static HTML and don't even have any associated code. However, since the Master Page has a <form runat="server"> tag which wraps all ContentPlaceHolders, the resulting HTML always contains the ViewState field, i.e: ...

Python optimization

Hi, I do like this: f = open('wl4.txt', 'w') hh = 0 ###################################### for n in range(1,5): for l in range(33,127): if n==1: b = chr(l) + '\n' f.write(b) hh += 1 elif n==2: for s0 in range(33, 127): b = chr(l) + chr(s0) + ...

Visual C++.NET , speed optimizations

Hello, I want my VC++ code to be executed as fast as possible. Does anybody know what I should change or set in project properties and settings? ...

Optimal Sharing of heavy computation job using Snow and/or multicore

Hi, I have the following problem. First my environment, I have two 24-CPU servers to work with and one big job (resampling a large dataset) to share among them. I've setup multicore and (a socket) Snow cluster on each. As a high-level interface I'm using foreach. What is the optimal sharing of the job? Should I setup a Snow cluster...

Simple MySQL Query taking 45 seconds (Gets a record and its "latest" child record)

I have a query which gets a customer and the latest transaction for that customer. Currently this query takes over 45 seconds for 1000 records. This is especially problematic because the script itself may need to be executed as frequently as once per minute! I believe using subqueries may be the answer, but I've had trouble constructing...

WAN Optimization Resources

I'm looking for resources on writing software to do WAN optimization. I've googled this and searched SO, but there doesn't seem to be much around. The only things I've found are high-level articles in tech magazines, and info for network admins on how to make use of existing WAN optimization products. I'm looking for something on the te...