optimization

What's your all-in-one web resource optimizer?

I'm working with SmartOptimizer: minify js and css, use css data uris, add far expire headers and other features. (http://farhadi.ir/works/smartoptimizer) It works fine, but i don't know if exists a similiar application with similar or best tools (like Google Closure, CSScaffold,..) If you're not sure witch is better, what's your favour...

Python: Optimizing, or at least getting fresh ideas for a tree generator.

I have written a program that generates random expressions and then uses genetic techniques to select for fitness. The following part of the program generates the random expression and stores it in a tree structure. As this can get called billions of times during a run, I thought it should be optimized for time. I'm new to programming...

Switch optimization for many cases guarantees equal access time for any case? ( C++ )

Hi, I've seen answers here for specific languages, about switches with more than 5 cases being optimized with jump tables to guarantee constant access time for any case. Is that so for C / C++? Is it in particular for gcc? for visual studio? If not, would sorting cases in order of occurrence frequency help? ...

iPhone / Objective C: How to log a methods execution time exactly in milliseconds?

Is there any way to determine how long a method needs for execution? In seconds would be not accurately enough - in milliseconds would be better. ...

jQuery animation on multiple elements, single animation thread/timer or multiple?

Hi, I'm wondering when the jQuery selector returns multiple elements and I do a "slideDown" for example on all those element... $('.allthisclasss').slideDown(); Is there a single loop of code that moves all objects down in synch or if jQuery treats all objects separately and they each have a thread of execution to move themselves? My...

Matlab: Magnetic fields calculated with biot-savarts-law

Hello! This is the code for the computation of magnetic fields using the biot-savart-law. I hope to get some tipps for the optimization of this code. Regrettably I use german language :( I never will do this again. :) tic clear all; clc; clf skalierungsfaktor = 10^-6; % vom m-Bereich zum mm-Bereich wg. T = Vs / m^2 I = 1; % in A konstan...

C# better to initialize list then loop over it, or just initialize in loop condition?

I end up with a lot of code like this: List<string> dates = someMethodCall(); foreach (string dateStr in dates) { } I usually declare the object over which I'm iterating and then use it in the foreach condition out of worry that someMethodCall() would happen for each iteration of the loop. Is this the case? I would prefer to do this...

Large-scale jQuery Architecture

I do a lot of work on large-scale ecommerce systems. Our backend-code and html are fairly compartmentalized into large chunks based on functionality for the major sections of the system - product (browse, detail), account, checkout, etc. There are section-specific files for JS, but they are currently being concatenated and minified into ...

Dictionary with no 'payload' value in .Net

Occassionally I need to check for duplicate IDs in a set of values and generally I use a Dictionary for this - using just the keys and leaving values empty. Note that this is tight and highly optimized code so please no cries of 'premature optimization'! Assuming scenarios where CPU and RAM are being squeezed to the limit I was wanting...

C#-fu - finding top-used words in a functional style

This little program finds the top ten most used words in a file. How would you, or could you, optimize this to process the file via line-by-line streaming, but keep it in the functional style it is now? static void Main(string[] args) { string path = @"C:\tools\copying.txt"; File.ReadAllText(path) .S...

Tips and Tricks about query optimization [SQL Server 2005]

I am asking this question in stackoverflow because its the right place to ask... I know its a very vast topic to start but some small ones which may be really handy... It might be useful for young developers like me to know about query optimization.. Some Tips and Tricks about query optimization in SQL Server 2005.. ...

Can you cache a virtual function lookup in C++?

Say I have a virtual function call foo() on an abstract base class pointer, mypointer->foo(). When my app starts up, based on the contents of a file, it chooses to instantiate a particular concrete class and assigns mypointer to that instance. For the rest of the app's life, mypointer will always point to objects of that concrete type. I...

g++ compiler: optimization flag adds warning message

I noticed this interesting behaviour of the g++ compiler, if I add a -O3 flag to the compiler, I get otsu.cpp:220: warning: ‘x’ may be used uninitialized in this function However, when I do not use optimization and instead use a debug flag -g I got no warnings at all. Now, I trust the compiler more when the -g flag is on; however, I'm...

How to optimize modular flash apps (load time & flexibility)?

Hi all, I'm working on a large application that is broken up into many independent swfs. There is a master swf that loads a navigation shell and the foundational logic, and a module loading system that loads child swfs into the main display area. This is all working smoothly, and now I'm onto building the modules, and I'm starting to fe...

Which is the best for this query, "Inner join" or "Where"

I have this query, our friend "OMG Ponies" help me to make it :) :- SELECT t.id AS taskid, STUFF( ( SELECT ',' + x.tID FROM ( SELECT CAST(id AS VARCHAR(200)) AS tid FROM CRSTask c WHERE c.ParentTask = 7562 -...

CakePHP Controller::persistModel and Form Automagic

I am developing an app using the CakePHP framework. I just recently read an article that said enabling var $persistModel = true; could lead to performance gains. As I am working on a development server I thought I'd give it a try. Lo and behold the site was slightly faster at the cost of losing form automagic. For example, all user...

Best way to comparing perormance of different version of library

Hi Currently for each call in library,I am doing multiple iteration , Measuring time taken for each call and then calculating : Average time taken for each call Min time take Max time taken Standard Deviation But it seems its not a good method . As these time depends upon state of machine ,As if CPU is busy with other process res...

g++ does it make sense to add optimization flag when compiling static library

Or does it just make more sense to leave the optimization until you use the library, or is it when you link the library you are already past the point where the compiler can optimize the library? ...

C++ optimise class template function when template parameters identical

I've got a template class with a template method within it, giving two template parameters T and U. The operation is quite expensive and is showing up in profiling to be a major use of CPU time. I could optimise it somewhat, but only for the case where T == U (which is fairly common), however I'm not sure on the syntax for doing this... ...

Find the most points enclosed in a fixed size circle

This came up when a friend talked about a programming competition, and we wondered what the best approach was: Given a list of points, find the centre of a circle of predetermined size that covers the most points. If there are several such circles, its only important to find one of them. Example input: 1000 points, in a 500x500 space,...