optimization

Is it better to echo javascript in raw format with php, or echo a script include that has been minified and gzipped?

Hey guys quick question, I am currently echoing a lot of javascript that is based conditionally on login status and other variables. I was wondering if it would be better to simply echo the script include like <script type="text/javascript" src="javascript/openlogin.js"></script> that has been run through a minifying program and been gzi...

Optimize css vs Google page speed is messing with me

I'm using google page speed and it's telling me my css is inefficient... Very inefficient rules (good to fix on any page): * table.fancy thead td Tag key with 2 descendant selectors and Class overly qualified with tag * table.fancy tfoot td Tag key with 2 descendant selectors and Class overly qualified with tag The css rules ar...

Does Delphi really handle dynamic classes better than static?

Hello, I was told more than once that Delphi handles dynamic classes better than static.Thereby using the following: type Tsomeclass=class(TObject) private procedure proc1; public someint:integer; procedure proc2; end; var someclass:TSomeclass; implementation ... initialization someclass:=TSomeclass.Create; finalizat...

What is fastest way to find number of matches between arrays?

Currently, I am testing every integer element against each other to find which ones match. The arrays do not contain duplicates within their own set. Also, the arrays are not always equal lengths. Are there any tricks to speed this up? I am doing this thousands of times, so it's starting to become a bottle neck in my program, which is ...

Thin down jQuery

Hi, I have been optimizing my website but the one problem that stands in my way is all the jQuery functions that I do not use. The only ones that I use are for a smooth page scroller. It just seems like such a waste of download time. My question is: Is there any script or program that will remove the jQuery code that I do not need and l...

Faster integer division when denominator is known?

hi I am working on GPU device which has very high division integer latency, several hundred cycles. I am looking to optimize divisions. All divisions by denominator which is in a set { 1,3,6,10 }, however numerator is a runtime positive value, roughly 32000 or less. due to memory constraints, lookup table may not be a good option. Ca...

Vector [] vs copying

What is faster and/or generally better? vector<myType> myVec; int i; myType current; for( i = 0; i < 1000000; i ++ ) { current = myVec[ i ]; doSomethingWith( current ); doAlotMoreWith( current ); messAroundWith( current ); checkSomeValuesOf( current ); } or vector<myType> myVec; int i; for( i = 0; i < 1000000; i ++ ) { doSome...

Is it possible to shrink rt.jar with ProGuard?

Is there a procedure by which you can optimize/shrink/select/obfuscate only 'used by your app' classes/methods/fields from rt.jar provided by Sun by using some optimization software like ProGuard (or maybe other?). Then you would actually be able to minimize the download size of your application considerably and make it much more secure ...

How to optimize this JSON/JQuery/Javascript function in IE7/IE8?

hi guys, i'm using this function to parse this json data but i find the function to be really slow in IE7 and slightly slow in IE8. basically the first listbox generate the main product list, and upon selection of the main list, it will populate the second list. this is my data: [{"ProductCategoryId":209,"ProductCategoryName":"X-Fi","...

Shouldn't prepared statements be much faster?

$s = explode (" ", microtime()); $s = $s[0]+$s[1]; $con = mysqli_connect ('localhost', 'test', 'pass', 'db') or die('Err'); for ($i=0; $i<1000; $i++) { $stmt = $con -> prepare( " SELECT MAX(id) AS max_id , MIN(id) AS min_id FROM tb "); $stmt -> execute(); $stmt->bind_result($M,$m); $stmt->free_result(); $rand = mt_rand( $m , ...

Is there table with timing(cost) of C functions?

Preferable for x86-32 gcc implementation ...

Will unused destructor be optimized out?

Assuming MyClass uses the default destructor (or no destructor), and this code: MyClass *buffer = new MyClass[i]; // Construct N objects using placement new for(size_t i = 0; i < N; i++){ buffer[i].~MyClass(); } delete[] buffer; Is there any optimizer that would be able to remove this loop? Also, is there any way for my code to d...

How to optimize Community Server engine to decrease server loads?

I am using Community Server 2007 Express engine (1000+ unique hosts per day) and have some problems with hosting provider. How can I optimize engine to decrease server loads? ...

Python: Memory usage and optimization when modifying lists

The problem My concern is the following: I am storing a relativity large dataset in a classical python list and in order to process the data I must iterate over the list several times, perform some operations on the elements, and often pop an item out of the list. It seems that deleting one item out of a Python list costs O(N) since Py...

Useful Android system resources

Android comes with lots of system resources (android.R) that can be used to save you time and make your application lighter. For example, I recently discovered that Android provides localized strings for Yes (android.R.strings.yes), No (android.R.strings.no), Cancel (android.R.strings.cancel) and Ok (android.R.strings.ok), among other s...

Best approach to optimize a record history database

I have a database that keeps record history. For each update to a record, the system will "deactivate" the previous record (along with all it's children), by setting the "Status" column to "0". Now it's not a problem yet...but eventually this system is going to have a lot of records, and history is more important than speed right now. B...

[C++] Is it possible to roll a significantly faster version of sqrt

In an app I'm profiling, I found that in some scenarios this function is able to take over 10% of total execution time. I've seen discussion over the years of faster sqrt implementations using sneaky floating-point trickery, but I don't know if such things are outdated on modern CPUs. MSVC++ 2008 compiler is being used, for reference.....

[C++] Is it possible to roll a significantly faster version of modf

In an app I'm profiling, I found that in some scenarios this function is able to take over 10% of total execution time. MSVC++ 2008 compiler is being used, for reference... I don't recall if modf maps to a single instruction or if there is likely any way to make it faster. see also here for similar question on sqrt function Unlike sqr...

SQL Table Setup Advice

Hi all. Basically I have an xml feed from an offsite server. The xml feed has one parameter ?value=n now N can only be between 1 and 30 What ever value i pick, there will always be 4000 rows returned from the XML file. My script will call this xml file 30 times for each value once a day. So thats 120000 rows. I will be doing quite comp...

Including associations optimization in Rails

Hey, I'm looking for help with Ruby optimization regarding loading of associations on demand. This is simplified example. I have 3 models: Post, Comment, User. References are: Post has many comments and Comment has reference to User (:author). Now when I go to the post page, I expect to see post body + all comments (and their respectiv...