performance

Best practice to use ConcurrentMap's putIfAbsent

I have been using Java's ConcurrentMap for a map that can be used from multiple threads. The putIfAbsent is a great method and is much easier to read/write than using standard map operations. I have some code that looks like this: ConcurrentMap<String, Set<X>> map = new ConcurrentHashMap<String, Set<X>>(); // ... map.putIfAbsent(name,...

Generating XML dynamically VS generating xml file

Hey guys, I have to load some XML data (generated from a database, using PHP) into a flash slideshow. The database data will change only when someone edit the website at it's backend. In terms of loading speed and performance, which is best: 1) Generate the XML data dynamically from the database, each time the page is loaded; 2) Ge...

Mysqltuner suggestions and changes to my.cnf

Had this question on Serverfault for a few days with no luck. I've run mysqltuner.pl on a VPS and have a bunch of questions as to the suggestions on variables to change. I'm sure these are general questions with complex answers. I'm not knowledgable enough to write queries and test them against the server, but am just trying to get a b...

mysql performance: nested insert/duplicate key vs multiple updates

Hello. Does anyone know what would be more efficient and use less resources: Method 1-- Using a single SELECT statement to get data from one table and then iterating through it to execute multiple UPDATEs on another table. E.G. (pseudo-code, execute() runs query): Query1_resultset = execute("SELECT item_id, sum(views) as view_count F...

Is it better to query on the FK or the PK in a join query

Using SQL2k5 and assuming the [ID] columns are the clustered PK and the [FK...] columns have a nonclustered index, of the two queries, which WHERE clause is more efficient? SELECT * FROM [table1] INNER JOIN [table2] ON [table2].[ID] = [table1].[FK_table2] INNER JOIN [table3] ON [table3].[ID] = [table1].[FK_table3] WHERE [table1].[FK...

Resource recommendations for Windows performance tuning (realtime).

Hi all, Any recommendations out there for Windows application tuning resources (books web sites etc.)? I have a C++ console application that needs to feed a hardware device with a considerable amount of data at a fairly high rate. (buffer is 32K in size and gets consumed at ~800k bytes per second) It will stream data without under run...

Javascript transitions on CSS scaled images perform poorly

I am working on a front page gallery which has several images, scaled to fit the page via CSS. The images fade from one to the next (overtop of each other), and will resize if the user resizes the browser to use up the space. The problem is that the image fading performs terribly on most browsers and on all but the newest computers. ...

android + mapview large amount of marquers

I have been following the hello mapview tutorial In the tutorial they use a custom implementation of the ItemizedOverlay class. I tried using this approach but I am getting very poor performance when I add a large number of OverlayItems. This leads me to think that the tutorial I used is not best suited for my needs. Can anyone point m...

Facebook users_getStandardInfo is very slow. Is the FQL or CURL slow?

So, I am running a facebook application and I have to call FQL quite frequently. e.g. calling $fbObj->api_client->users_getStandardInfo() with the old facebookapi_php5_restlib However, I found it VERY VERY VERY SLOW to get the response back. I know that call actually use CURL connect to Facebook. So, is the CURL call slow in r...

Why can Linq operations be faster than a normal loop?

A friend and I were a bit perplexed during a programming discussion today. As an example we created a fictive problem of having a List<int> of n random integers (typically 1.000.000), and wanted to create a function that returned the set of all integers that there were more than one of. Pretty straightforward stuff. We created one linq s...

Get System Time and User Time

Hi, I'm working on linux and am using the values in /proc//stat to log performance data. I am currently logging process user time and process system time. The problem that I have run into is that the code puts out correct values on ubuntu 10.04 but seems to be wrong under fedora 13. Under fedora it looks like the counter for process us...

Best way to insert hundreds of DOM elements into the page dynamically while keeping performance high

I have a web app where we would be inserting hundreds of elements into the DOM Essentially, I'm doing $('#some_element').html('<lots of html here>'); repeatedly. In some cases I might need to do $('#some_element').appendTo('more html'); From previous experience inserting html text using the append or setting the innerHTML of an ...

Linux Performance Stats Behaving Oddly

Hi, I'm using the linux /proc//stat file to generate cpu usage information for an application. The issue that I have run into is that on Fedora 13 things seem to act strangely whlie on ubuntu 10.04 things behave as I expect them to. Specifically: on fedora the application logs more process system time by a ratio of 3:1 on ubuntu the ap...

Writing hashCode methods for heterogeneous keys

I have a Java HashMap whose keys are instances of java.lang.Object, that is: the keys are of different types. The hashCode values of two key objects of different types are likely to be the same when they contain identical variable values. In order to improve the performance of the get method for my HashMap, I'm inclined to mix the name ...

Understanding Memory Performance Counters

[Update - Sep 30, 2010] Since I studied a lot on this & related topics, I'll write whatever tips I gathered out of my experiences and suggestions provided in answers over here- 1) Use memory profiler (try CLR Profiler, to start with) and find the routines which consume max mem and fine tune them, like reuse big arrays, try to keep refe...

JSF - RichFaces performance problems showing complex page.

Hi all, I am working on Weblogic 10.3.2, JSF 1.2, Richfaces 3.3.2 and Facelets 1.1.14. I have a serious performance problem, particularly showing my home page, which contains a very complex rich:datatable. When deploying the application on my local server, a request can take over 5 seconds to complete. The home page is a ui:composit...

Calling a method in a linq foreach - how much overhead is there?

I'm thinking of replacing a lot of inline foreaches with Linq and in so doing will make new methods, e.g. Current: foreach(Item in List) { Statement1 Statement2 Statement3 } Idea: List.Foreach(Item => Method(Item)) Obviously Method() contains Statement1..3 Is this good practise or is calling a method thousands of times...

Diagnosing performance problems with databound WPF ComboBox

I've been battling a "slow" WPF ComboBox this morning, and would love to see if anyone has tips for debugging such a problem. Let's say I have two ComboBoxes, A and B. When A changes, the items in B change as well. The ComboBoxes each have their SelectedItem and ItemsSource databound like this: <ComboBox Grid.Column="1" ItemsSource="...

IIS6 Cache - how to save cache state for the maximum possible time

Hello, I'm facing some performance problems with IIS6, and so I want to store things in cache for the maximum possible time so that when new requests arrive the content is already available in cache. Can anyone give me a hint how can I do this? ...

MySql queries: really never use SELECT * ?

I'm a self taught developer and ive always been told not to use SELECT *, but most of my queries require to know all the values of a certain row... what should i use then? should i list ALL of the properties every time? like Select elem1,elem2,elem3,....,elem15 FROM...? thanks ...