performance

Should I run multiple SELECTs inside a PDO transaction for performance gains?

Are PDO transcations intended just for UPDATE, INSERT and DELETE or can you achieve performance gains if you use a transaction for mulitple SELECT queries? ...

jQuery selector performance

Why is id selector faster than class selector in jQuery? ...

Why is PHP apt for high-traffic websites?

I was surprised to learn today that PHP is used widely in high-traffic websites. I always thought that PHP is not strong in terms of performance, being a dynamic, scripting language (e.g. compared to statically typed, compiled language like C/Java/C# etc.). So how come it performs so well? ...

Performance - checking if container is empty before doing operations on it?

Is there a significant difference between doing this... if ( !myVector.empty()) { for ( unsigned int i = 0; i < myVector.size(); ++i ) { // do stuff } } and this for ( unsigned int i = 0; i < myVector.size(); ++i ) { // do stuff } if the vector is empty? What is the cost of this on an empty vector? ...

How most popular media rich websites implement their media library?

I'm wondering how those popular media rich websites implement their media library. Do they store all the media files in the database? What kind of database do they use? Do they employ other mechanism to boost the performance? Thanks for any response. ...

How can I best monitor performance with unit tests?

I've been starting to write many more unit tests for my code (something I should have been doing for much longer,) as well as use code profilers such as EQATEC's to identify bottle necks. I'm wondering if there's a correct method for monitoring performance in unit tests? Obviously, a code profiler would be best for optimization, but wha...

C++: Fastest method to return a C string

I have a simple function that takes a char and return a string, in C it looks like; char* get_string(char c) { switch(c) { case 'A': return "some string"; Case 'B': return "some other string"; ... And it works fine, but then I wanted my code to work in C++, and the C++ compilers throws a gazillions "deprecated conversion fr...

delay the loading of 3rd party javascript

Is there ANY method to delay the loading of 3rd party JavaScript files until the rest of the page has finished loading? ...

Why "Properties that return arrays are prone to code inefficiencies"?

Hi, I have a piece of code which deals with customers stored in database. There is an object Customer, and it has, among other, two properties of type byte[]: one property for password salt, the second one for password hash. Checking the code with FxCop, I see that it complains (CA1819, Performance Rules) that: "Properties that ret...

python file copying

Is there any difference in speed of copying files from one location to another betwen python or delphi or c++ ? I guess that all 3 laguages uses same or similar win api calls and that there is not much performance difference. ...

any log about db queries executed in my site?

Hi, I own this site: www.gramma.ro. (asp.net/c#)... I've been working 2 days on doing improvements on UI using YSlow and PageSpeed. Well...at this moment the site seems to load ok...i mean from the UI point of view. (Page Speed improvments from 51 to 75; YSlow from F to D(C) ). BUT there is still "waiting" time between pressing a link...

Controlling calculation speed in a program

One of our comrades, Peter Mortensen , asked question on SuperUser about application which could consume arbitrarily percentage of CPU time. It piqued my interest. My question is how could such application be made: Here are some of my general ideas and why I think that they are bad: A calculation program could be made which will u...

Datamapper "first" method is querying the whole relation

I'm using Datamapper 1.0 with sinatra and sqlite3 as backend. I have some devices, which have multiple locations, and I usually only want the latest location of a device. The problem is that the generated SQL for the above line will query all locations for the device not just the latest one (and a device can have 10-20k locations). Thi...

Asp.net profile ProfileBase GetPropertyValue performance issue in linq statement

I has method which should return users with highest points. Points are stored in aspnet_Profile table, so i can get these points in the way like this: ProfileBase.Create(mu.UserName).GetPropertyValue("Points"). So at first i call IEnumerable<MembershipUser> users = Membership.GetAllUsers().Cast<MembershipUser>(); and then (i'm usi...

HashSet . slow performance in big set

Hi! I have encountered a problem i cannot find a solution. I am using a HashSet to store values. The values I store is of the custom type Cycles where i have overridden the HashCode and equals as following in order to make sure the slow performance is not cuased by the hascode or the equal methods Also i have set the initial capacity of...

Running a query multiple times vs using a cookie

A question about query/database performance: I have a table that records how many “points” a user has earned. There is 1 row for every 1 point. When someone gains 20 points, 20 rows are inserted into the database. When someone looses 20 points, I will add a row with the value of “-1” in the database. Thus the number of points someo...

__get/__set/__call performance questions with PHP

I have a custom-built MVC PHP framework that I am in the process of rewriting and had a question about performance and magic methods. With the model portion of the framework, I was thinking if __get/__set magic methods would cause too much performance hit to be worth using. I mean accessing (reads and writes) model data is going to be ...

Webservices performance best practices

All, I am working on creating a toolbar that looks at certain links on a page and injects some links of my own by getting them from a webservice, which I am writing too. There can be 100s of links on a page and there can be 100,000s of such toolbars installed. The question is, what are the best practices I should follow to make sure t...

Java heap bottleneck - how to identify the cause?

I have a J2EE project running on JBoss, with a maximum heap size of 2048m, which is giving strange results under load testing. I've benchmarked the heap and cpu usage and received the following results (series 1 is heap usage, series 2 is cpu usage): It seems as if the heap is being used properly and getting garbage collected properly...

How can I speed up my PHP based website?

I just built a small PHP based site from scratch, yay for me! But given the size of it, it's running a little slower than I expected. I have the files/folders organized like this: articles [folder] css [folder] html [folder] images [folder] js [folder] photography [folder] resources [folder] articles.php [file] bio.php [file] ...