optimization

Is there a library to do CSS spriting automatically?

CSS Spriting can really help performance, but it's not the easiest thing to read and maintain. Are there any tools that would let me code the images individually but aggregate them up and replace the HTML with the correct subset of the montage? I'm specifically thinking a Ruby on Rails plugin, but if there's a package for another langu...

System.DirectoryServices pegs my processor when multi-threaded - can I lower the burden?

My application takes the currently logged-in user and uses an a DirectoryServices.DirectorySearcher to pull a few additional detail about them (some properties we have stored in a few custom AD fields, as well as their email address). This works great, though I've always though it was a little slow - my single-threaded code could only ma...

How to parallelize small pure function?

I have D2 program that, in its current form, is single threaded, and calls the same pure function about 10 to 100 times in an inner loop for each iteration of the outer loop of this program. There is no data dependency among the calls, i.e. no call uses the result from any other call. Overall, this function is called millions of times,...

How can I optimize my basic physics simulator?

I've written a simple physics modeler that allows me to bounce balls around the screen. You can click and drag to launch a ball, or you can generate balls hundreds at a time and watch them interact with eachother. [Link to larger version] It has been a fun little program to work on and I want to take it further if I can. I know they ...

Showing tab with lots of ComboBox controls is slow with WinForms

I have set up a dialog with several tabs. One of these contains twenty combo boxes, each with over 100 items, added like this : foreach (var x in collection) { string text = FormatItem (x); combo.Items.Add (text); } so there is nothing fancy at all with the items. They are plain strings and the combo boxes get filled when the ...

Is there a free/open-source JavaScript-to-JavaScript compacting compiler (like Google's)?

If you look at the source of Google pages with JavaScript, you'll find that the JavaScript is clearly not readable -- or maintainable. For example, all variables and functions are one-letter named (at least, the first 26 are...); there are no extraneous white-spaces or linebreaks; there are no comments; and so on. The benefits of this c...

Performance implications of sql 'OR' conditions when one alternative is trivial ?

I'm creating a stored procedure for searching some data in my database according to some criteria input by the user. My sql code looks like this: Create Procedure mySearchProc ( @IDCriteria bigint=null, ... @MaxDateCriteria datetime=null ) as select Col1,...,Coln from MyTable where (@IDCriteria is null or ID=@IDCriteria) ... and (@Max...

How can a custom ASP.NET control cache data without using the ViewState?

I'm not sure if this is possible in ASP.NET, but here is the problem I have: some of the data lists on my web application are displayed using a GridView; however, because some of these lists can contain a lot of data, they sometime push the page weight up into the several megabyte range due to the ViewState. Since we don't want to requer...

MySQL not using indexes with WHERE IN clause?

I'm trying to optimize some of the database queries in my Rails app and I have several that have got me stumped. They are all using an IN in the WHERE clause and are all doing full table scans even though an appropriate index appears to be in place. For example: SELECT `user_metrics`.* FROM `user_metrics` WHERE (`user_metrics`.user_id...

Using SSE instructions

I have a loop written in C++ which is executed for each element of a big integer array. Inside the loop, I mask some bits of the integer and then find the min and max values. I heard that if I use SSE instructions for these operations it will run much faster compared to a normal loop written using bitwise AND , and if-else conditions. M...

Super slow C# custom control

Hi everyone I've made a custom control, it's a FlowLayoutPanel, into which I put a bunch of other custom controls (just Buttons, each with three Labels and a PictureBox overlayed) It works ok with around 100 buttons, but bump that up to 1000 and it's in trouble. Bump that up to 5000 and it just dies after 20 seconds. I have very littl...

Optimizing "ORDER BY" when the result set is very large and it can't be ordered by an index

How can I make an ORDER BY clause with a small LIMIT (ie 20 rows at a time) return quickly, when I can't use an index to satisfy the ordering of rows? Let's say I would like to retrieve a certain number of titles from a table 'node' (simplified below). I'm using MySQL by the way. node_ID INT(11) NOT NULL auto_increment, node_title VAR...

Is it worth from a browser's performance perspective to compress http responses?

The browser is probably closer to be CPU-constraint than network constraint, right? We have a very heavy ajax application, so from the brower's perspective (not the server) perhaps it should be better not to use compression. What do you think ...

Artificial Intelligence Search Question

Hello, everybody. I am working on a university timetable scheduler project. Mainly, I am using taboo search, but I want to ask: In general search, you can explore all neighbors of the current state and then take the best state - according to a fitness or evaluation function, - but in such a project, generating all neighbors will make p...

graphics: best performance with floating point accumulation images

Hello stackoverflow, I need to speed up some particle system eye candy I'm working on. The eye candy involves additive blending, accumulation, and trails and glow on the particles. At the moment I'm rendering by hand into a floating point image buffer, converting to unsigned chars at the last minute then uploading to an OpenGL texture. ...

Performance tips for classic asp?

Hi, Today I was tasked to improve the performance of a classic ASP page. Rewriting the code in ASP.NET is at this moment not an option so I took up the challenge to squeeze every ounce of performance I can get out of the page. The page consists of the basic "SELECT bla bla FROM bla" into a couple of recordssets. A while loop iterates t...

What are you favorite low level code optimization tricks?

I know that you should only optimize things when it is deemed necessary. But, if it is deemed necessary, what are your favorite low level (as opposed to algorithmic level) optimization tricks. For example: loop unrolling. ...

Numerical optimization...

Hi there I was wondering which Integer or Float types are the fastest.. i was thinking byte is faster than integer because it has a smaller range. Some people told me .. that in some cases integer is faster than a byte. second question : The GPU is on his way to World Domination .. so i asked myself : Can a Double "be faster" than a I...

What standard optimization refactoring can I do to my Java application?

I have a semi big Java application. It's written quite poorly and I suspect there are quite a lot of simple things I can do that will clean things up a bit and improve performance. For example I recently found the String.matches(regex) function used quite a lot in loops with the same regex. So I've replaced that with precompiled Patt...

What are some ways to optimize your use of ASP.NET caching?

I have been doing some reading on this subject, but I'm curious to see what the best ways are to optimize your use of the ASP.NET cache and what some of the tips are in regards to how to determine what should and should not go in the cache. Also, are there any rules of thumb for determining how long something should say in the cache? ...