performance

jQuery: slow 'Webkit' performance - function .hover

Hey. I'm trying to get this script to work smoothly in webkit (Safari, Chrome, newest versions). It runs absolutely fine in Firefox. This code is called in the document.ready function: $('#noScript').remove(); $("#content div.wrapper, #top div.wrapper").hide().stop().fadeIn({duration: 2000, queue: true }); $('#social a') .children('s...

How many elements does it take for event delegation to become worthwhile?

Reading another SO question about jQuery performance, I started thinking about the point when it becomes worth using event delegation rather than binding to elements individually. I was thinking mainly about jQuery, but I suppose it is probably applicable for Javascript in general. Event delegation has two main purposes: allowing han...

Rails Users has_one :profile vs. show page

Hello, I have a best practice/efficiency/performance issue. If I want to have a profile page for each user in my system and i already have a user model. Is it better to have all the users information in the user model and pull it on the show page of users so users/show will access the user model and grab all the relevant data like a...

NSMutableArray initWithCapacity nuances

Hi, Does anyone have advice on how to best initialize an NSMutableArray when it comes to dictating the capacity? The documentation mentions that "...even though you specify a size when you create an array, the specified size is regarded as a “hint”; the actual size of the array is still 0." So... 1) If I init with a greater capacity t...

Using Parallelization for relatively large loops

I have an 8-core CPU machine with 8 GB memory. Logically the following code can be done in parrallel, but since the loop exposes more than enough opportunities for parallelism since I have far fewer cores available than the size of the loop. Second, every delegate expression allocates some memory to hold the free variables. Is it recomme...

MySQL Left Join, Group By, Order By, Limit = Terrible Performance

Hi Guys, I am currently developing a an application to allow users to search through a database of documents using various paramaters and returning a set of paged results. I am building it in PHP/MySQL, which is not my usual development platform, but its been grand so far. The problem I am having is that in order to return a full set ...

Calculating the spread of the hash function for a hashmap which uses chaining

Hello everyone, I am writing a generic hash map in C++ which uses chaining to deal with collisions. Say if I have a hash map with 11 buckets, and I insert 8 items. The hash function will distribute it as follows: bucket[0] = empty bucket[1] = 2 elements bucket[2] = empty bucket[3] = 1 element bucket[4] = 1 element bucket[5] = 3 eleme...

Approach bottlenecks in a code

All, Given a code that you are not at all knowledgeable about in terms of the functionality and implementation, how would you go about finding the performance bottlenecks in that code? Please list any specific tools / standard approaches that you might be using. ...

Add an entity from another DataContex in linq

I am trying to merge data between two identical schema databases using Linq-to-sql: List<Contact> contacts = (from c in oldDb.Contact select c).ToList(); contacts.ForEach(c => c.CreatedByID = 0); newDb.Contact.InsertAllOnSubmit(contacts); newDb.SubmitChanges(); Merely throws an "An attempt has been made to Attach or Add an entity ...

Mono code in ubuntu runs faster than the same code in Windows

I have a simple Application built using Mono on Ubuntu that prints out the entries of a list in sequence. The code takes about 6 ms to execute on Ubuntu, however the same code takes about 40 ms to execute on windows. Is there a reason why the same application code would run faster on Ubuntu than it would using the actual .net runtime on ...

Optimize ActiveRecord initialization time (on application start)

For every application_start, I call ActiveRecordStarter.Initialize (actually it's part of the ActiveRecordIntegration facitliy). This seems to be very heavy, takeing around 3.5 seconds to initialize my 16 objects. some background: 1. got 16 AR objects for now, almost never changed (maybe once a week). 2. most of the changes are not AR r...

Why is putImageData so slow?

I am working with a relatively large Canvas where various (complex) stuff is drawn to. I then want to save the Canvas' state, so I can quickly reset it to the state it now is at a later point. I use getImageData for this and store the data in a variable. I then draw some more stuff to the canvas and will later reset the Canvas to where i...

What makes this bucket sort function slow?

The function is defined as void bucketsort(Array& A){ size_t numBuckets=A.size(); iarray<List> buckets(numBuckets); //put in buckets for(size_t i=0;i!=A.size();i++){ buckets[int(numBuckets*A[i])].push_back(A[i]); } ////get back from buckets //for(size_t i=0,head=0;i!=numBuckets;i++){ //size_t bucket_size=buckets[...

c#: send mass mail with BCC: "To" field is not filled

For sending mass emails I use single instance of MailMessage class and filling it Bcc property with collection of addresses. However when mail comes, its "To" field is not filled. I've got two questions: how can I make "To" field filled with appropriate address? how sending single message to multiple recipients with Bcc field compared ...

Addressing Scalability,Performance and Optimization issues in RMI Application?

Dear Experts, my problem is: this design is working fine for one ball but i m unable to get it work for multiple balls, i have basically problem in replacing the "this" keyword in updateClients (). i thought i need to do something like this but i m failed: System.out.println("in ballimpl" + j.size()); for (ICallback aClie...

What are the most important optimizing performance best practices in C#

Hi When I'm reading this tutorial I noticed the following performance tip about using structs in C#: Unless you need reference type semantics, a class that is smaller than 16 bytes may be more efficiently handled by the system as a struct. I looked for similar question in stackoverflow but I found some questions that talks a...

Poor FTP Performance due to delayed Ack : Solutions exist for Android?

Hello, i have a Problem using FTP connection on Android 2.2 devices. My app uses AndFTP via intent and loads data from a FTP Server connected via Wifi to the handset. The FTP downloadspeed is only 7kByte/s. I had the same speed on my Windows XP Notebook, then i changed the delayed acknowledge setting. So now my Notebook reaches 30...

apache/php : possible to throttle uploads?

My website allows users to upload their photos Can I put kb/sec (or similar) limit on uploads to prevent them impacting performance of the frontend of my site? ...

Are there any performance bottle necks in template inheritance?

Are there any performance bottle necks in template inheritance ...

what are the consequences of having unused functions

Hi, I'm wondering what / if any consequences there are in having unused functions in code? If you hunt down and remove all unused functions and variables would there be any percievable improvement in performance? Or is it just good practice to remove unused functions and variables would? ...