optimization

How much does loading images or saving images to the server affect the server load?

If too many images are being loaded from the server at once (or over a period of time) will it slow down the website for users? What about saving images to the server? Would a website that puts a lot of stress on the server makes the website more vulnerable to DOS attacks? If our website needs to save and load mass amount of images, i...

How to optimize MySQL Views

I have some querys using views, and these run a lot slower than I would expect them to given all relevant tables are indexed (and not that large anyway). I hope I can explain this: My main Query looks like this (grossly simplified) select [stuff] from orders as ord left join calc_order_status as ors on (ors.order_id = ord.id) calc_...

How should this be designed?

Hello SO Gus, I'm working on project that lets users choose some scientific authors and columnists and track their activities. Users can track authors activities either by : Choosing the author explicitly and then tracking him Or Choosing a channel (a list of authors that some other user tracks) and track the entire channel He...

Optimizing recursive calls over data structures

Is there an algorithm to optimize a highly recursive function into an iteration over a data structure? For example, given the following function... // template <typename T> class BSTNode is defined somewhere else // It's a generic binary search tree. template <typename T, typename R> void in_order(BSTNode<T>* root, R (*routine)(T)) { ...

Optimize F# string concatenation

I'm building a MySql query that batch inserts 4096 records at once. The actual insert is quite fast but the bottleneck is generating the query. Any hints on optimizing this? The string generation is currently taking about 18 times longer than the query. let builder = StringBuilder(524288) Printf.b...

Does my basic PHP Socket Server need optimization?

Like many people, I can do a lot of things with PHP. One problem I do face constantly is that other people can do it much cleaner, much more organized and much more structured. This also results in much faster execution times and much less bugs. I just finished writing a basic PHP Socket Server (the real core), and am asking you if you ...

Temporary table store in SQLite on the iPhone

I use temporary tables in an SQLite based iPhone application. Performance was not as was required so I looked at various candidates for optimization. Most of these worked well and had the desired effect. However, I'd also like to try moving the temporary tables from flash into memory to see if there is any improvement. On an actual de...

In terms of today's technology, are these meaningful concerns about data size?

We're adding extra login information to an existing database record on the order of 3.85KB per login. There are two concerns about this: 1) Is this too much on-the-wire data added per login? 2) Is this too much extra data we're storing in the database per login? Given todays technology, are these valid concerns? Background: We don'...

Is the inequality operator faster than the equality operator?

I know this is a micro-optimization, so I ask out of pure curiosity. Logically, a microprocessor does not need to compare all the bits of both operands of an inequality operator in order to determine a "TRUE" result. Note, this is programming-related because it affects the execution speed of a program. ...

(Simple?) Label Placement for Line Graphs

I'm drawing elevation profiles showing the elevation gain/loss along a trail, similar to the one below: This is basically a line graph with distance from the start on the x-axis and elevation on the y-axis. I'd like to provide fancy labels with spot elevations at interesting points along the trail, like the ones I have added by hand ...

Most efficient way of converting String to Integer in java

There are many ways of converting a String to an Integer object. Which is the most efficient among the below: Integer.valueOf() Integer.parseInt() org.apache.commons.beanutils.converters.IntegerConverter My usecase needs to create wrapper Integer objects...meaning no primitive int...and the converted data is used for read-only. ...

Why does SQLyog returns MySQL query results 10x faster than my Delphi program?

select rectype,jobid,jobrecid,template,assignedto,entereddt,enteredby,ref1,processed,processeddt, processbydt,title,description,connectlanhandle,finished,updateddt,ref2,cancelled, requireaccept,acceptrejectstate,acceptrejectbydt,alert1dt,alert2dt,alert3dt,despatchallowed, flag,ref3,projectid,duration,skillset,postcode,prefschedulefrom,pr...

Mysql OPTIMIZE TABLE for all fragmented tables

Id like to run optimize on all currently framgmented tables. These tables should be those that have information_schema.DATA_FREE > 0. Is it possible to optimize all tables with this property in one command in sql or will I have to write external code to do this? ...

template-ing a for loop in C++?

First time poster, be gentle! I have a C++ snippet below with a run-time for loop, for(int i = 0; i < I; i++) for (int j = 0; j < J; j++) A( row(i,j), column(i,j) ) = f(i,j); The snippet is called repeatedly. The loop bounds 'I' and 'J' are known at compile time (I/J are the order of 2 to 10). I would like to unroll the loop...

Optimising asp.net vb code behind

I have the below code.. i am finding a way to optimise it.. is there anyway to optimise it using findcontrol and loops ?? also eliminating headofficeSelected,areaSelected ,headofficeSelected and only using storeSelected ? If (storeSelected = 1) Then tempCollector = tempCollector + "<br>" + "Department" + ": " + txt_panview3_ddinpu...

Whats a good way about troubleshooting a script in terms of performance (php/mysql)?

I've written a site CMS from scratch, and now that the site is slowly starting to get traffic (30-40k/day) Im seeing the server load a lot higher than it should be. It hovers around 6-9 all the time, on a quad core machine with 8gb of ram. I've written scripts that performed beautifully on 400-500k/day sites, so I'd like to think Im not ...

Python garbage collection

I have created some python code which creates an object in a loop, and in every iteration overwrites this object with a new one of the same type. This is done 10.000 times, and Python takes up 7mb of memory every second until my 3gb RAM is used. Does anyone know of a way to remove the objects from memory? ...

Rewrite the vb.net codebehind for asp webpage

Possible Duplicate: Optimising asp.net vb code behind I need to rewrite the below code : If (storeSelected = 1) Then tempCollector = tempCollector + "<br>" + "Department" + ": " + txt_panview3_ddinput1.SelectedItem.ToString tempCollector = tempCollector + "<br>" + "Store" + ": " + txt_panview3_input2.Text + "<br>" End ...

SQL: Help me optimize my SQL

Hi I'm looking to optimize my SQL. My database schema is: HOMES home_id address city state zip primary_photo_group_id HOME_PHOTOS photo_id (primary key) home_id (home primary key) photo_group_id (a photo group is the same image, resize from thumbnail to large size) home_photo_type_id (the size of the image be it a thumbnail or a...

Keeping your code in L1 cache

I have been reading Wikipedia's article on K programming language and this is what I saw: The small size of the interpreter and compact syntax of the language makes it possible for K applications to fit entirely within the level 1 cache of the processor. I am intrigued. How is it possible to have the whole program in L1 cache? Say,...