optimization

What are some resources I can use to learn profiling/optimizing?

I just inherited a C# project that runs way to slow and will have to start optimizing it. What I wanted to do first is learn a little more about profiling/optimizing since I didnt have to do it before. So the question is where do I start, what books/blogs/articels can i read? I do know OF the .net profilers like ANTS profiler and so on,...

Need Better Algorithm for Finding Mapping Between 2 Sets of Points with Minimum Distance

Problem: I have two overlapping 2D shapes, A and B, each shape having the same number of pixels, but differing in shape. Some portion of the shapes are overlapping, and there are some pieces of each that are not overlapping. My goal is to move all the non-overlapping pixels in shape A to the non-overlapping pixels in shape B. Since the n...

How to speed up Google adsense and analytics loading time?

This might fall under the category of "you can't", but I thought it might be prudent to at least see if there is something I can do about this. According to FireBug, the major bottleneck in my page loading times seems to be a gap between the loading of the html and the loading of Google adsense and analytics. Notice in the screenshot b...

Speed-optimise Windows Forms application

How to speed optimize WinForm applications. I am not talking about apparent .NET opt. technics - like ngen-ing, caching objects, etc. Already tried that and what I am up to is to reduce the form initilization time from a 1500 msec down to 500msec. Profiling has identified the slowest code and almost all of it is in the InitializeCompone...

Why isn't pass struct by reference a common optimization?

Up until today, I had always thought that decent compilers automatically convert struct pass-by-value to pass-by-reference if the struct is large enough that the latter would be faster. To the best of my knowledge, this seems like a no-brainer optimization. However, to satisfy my curiosity as to whether this actually happens, I created...

javascript/dom -- how expensive is creating vs rearranging dom nodes?

Hello, I'm trying to optimize a sortable table I've written. The bottleneck is in the dom manipulation. I'm currently creating new table rows and inserting them every time I sort the table. I'm wondering if I might be able to speed things up by simple rearranging the rows, not recreating the nodes. For this to make a significant differen...

How can I make resizing WPF windows less "laggy"?

I am relatively new in the WPF world and one thing I immediately noticed is how laggy the window content is drawn when you resize a window. For example if you have scrollbars at the window edges those scrollbars will be partly hidden while shrinking and have space between them and the window border when enlarging. This even happens with...

Combine and compress CastleProject MonoRails' formhelper.js and behaviour.js?

Anyone who works with CastleProject MonoRails MVC who knows if I can combine and/or compress formhelper and behaviour js files together into something like monorails.js? I want to get the amount of webrequests as low as possible.. ...

SQL query to return top N rows per ID across a range of IDs

Lets say I have a table containing several hundred million rows that looks something like this: memID | foo | bar | foobar 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 2 | blah | blah | bl...

Most efficient way to see if an ArrayList contains an object in Java

I have an ArrayList of objects in Java. The objects have four fields, two of which I'd use to consider the object equal to another. I'm looking for the most efficient way, given those two fields, to see if the array contains that object. The wrench is that these classes are generated based on XSD objects, so I can't modify the classes...

Can optimizations affect the ability to debug a VC++ app using its PDB?

In order to be able to properly debug release builds a PDB file is needed. Can the PDB file become less usable when the compiler uses different kinds of optimizations (FPO, PGO, intrinsic functions, inlining etc.)? If so, is the effect of optimization severe or merely cause adjacent lines of code to get mixed up? (I'm using VC2005, and ...

Measuring Query Performance : "Execution Plan Query Cost" vs "Time Taken"

I'm trying to determine the relative performance of two different queries and have two ways of measuring this available to me: 1. Run both and time each query 2. Run both and get "Query Cost" from the actual execution plan Here is the code I run to time the queries... DBCC FREEPROCCACHE GO DBCC DROPCLEANBUFFERS GO DECLARE @start DATETI...

At what point do you perform front-end optimization?

I'm talking about things like page/stylesheet caching, minifying javascript, etc. Half of me thinks it's better to do these things as early as possible while still in development so I can be consciously aware of more realistic speed and response issues as well as interacting with something that more closely resembles what will be deploy...

What is the fastest way to copy my array?

I'm doing some Wave file handling and have them read from disk into an array of bytes. I want to quickly copy portions from this byte array into another buffer for intermediate processing. Currently I use something like this: float[] fin; byte[] buf; //fill buf code omitted for(int i=offset; i < size; i++){ fin[i-offset] = (float) bu...

What's wrong with this query? EXPLAIN looks fine to me...

I'm going through an application and trying to optimize some queries and I'm really struggling with a few of them. Here's an example: SELECT `Item` . * , `Source` . * , `Keyword` . * , `Author` . * FROM `items` AS `Item` JOIN `sources` AS `Source` ON ( `Item`.`source_id` = `Source`.`id` ) JOIN `authors` AS `Author` ON ( `Item`.`author...

Lua Challenge: Can you improve the fannkuch implementation's performance?

Lua is currently the fastest scripting language out there, and its not so much slower than C/C++ for some sort of programs (on par when doing pidgits 1:1), however Lua scores really bad in a few benchmarks against C/C++. One of those is the fannkuch test (Indexed-access to tiny integer-sequence), where it scores a horrible 1:148 -- The...

Lua Challenge: Can you improve the mandelbrot implementation’s performance?

Status: So far the best answer's program executes in 33% of the time of the original program! But there is probably still other ways to optimize it. Lua is currently the fastest scripting language out there, however Lua scores really bad in a few benchmarks against C/C++. One of those is the mandelbrot test (Generate Mandelbrot set p...

Lua Challenge: Can you improve the spectral-norm implementation’s performance?

Lua is currently the fastest scripting language out there, and its not so much slower than C/C++ for some sort of programs (on par when doing pidgits 1:1), however Lua scores really bad in a few benchmarks against C/C++. One of those is the spectral-norm test (Eigenvalue using the power method N=5,500 ), where it scores a horrible 1:148...

How to get Google like speeds with php?

I am using PHP with the Zend Framework and Database connects alone seem to take longer than the 0,02 seconds Google takes to do a query. The wierd thing today I watched a video that said Google connects to 1000 servers for a single query. With latency I would expect one server for every query to be more efficent than having multiple serv...

Why not always use psyco for Python code?

psyco seems to be quite helpful in optimizing Python code, and it does it in a very non-intrusive way. Therefore, one has to wonder. Assuming you're always on a x86 architecture (which is where most apps run these days), why not just always use psyco for all Python code? Does it make mistakes sometimes and ruins the correctness of the ...