performance

How much can this c/c++ loop be optimized?

I am a newbie on optimization. I have been reading some reference on how to optimize c++ code but I have a hard time applying it to real code. Therefore I just want to gather some real world optimization technique on how to squeeze as much juice from the CPU/Memory as possible from the loop below double sum = 0, *array; array = (double*...

Large JSF dataTable backed by database that can handle paging/sorting

If have a large amount tabular data that I'm trying to display in a JSF datatable. Are there any any implementations or components out there that can handle database paging and sorting? I currently have to pull all the rows in the table back and handle paging and sorting client side in JSF. Unfortunately this is not very performant and ...

Update statement using IN clause issue

I have an update statement that goes thus: update tableA set val1='X', val2='Y' where id in ( select id from tableA A LEFT JOIN tableB B ON A.col1=B.col1 and A.col2=B.col2 where A.col3='xx' and B.col3= 'YY') Now, the inner SELECT statement runs in 10 minutes returning 1000 records (both tableA and tableB have ab...

Running VB.NET application on Windows 2003 server

Hi, I've developed a VB.NET application with Visual Studio 2008. The application communicates with SQL Server and processes a text file. My question is about performance. While I run it from Visual Studio 2008, it takes 3 sec to complete. The same is when I run the executable created by the Setup Wizard on my desktop (Windows XP sp 3)....

Python: Fast querying in a big dbf (xbase) file

Hi all, I have a big DBF file (~700MB). I'd like to select only a few lines from it using a python script. I've seen that dbfpy is a nice module that allows to open this type of database, but for now I haven't found any querying capability. Iterating through all the elements from python is simply too slow. Can I do what I want from py...

Making linq avoid using in memory filtering where possible

Consider the these two LINQ2SQL data retrieval methods. The first creates a 'proper' SQL statement that filters the data, but requires passing the data context into the method. The second has a nicer syntax but loads the entire list of that accounts projects, then does in memory filtering. Is there any way to preserve the syntax of th...

Update UITableView from API - performance issue

Hi, I have a UITableView thats loaded from an API call - the performance of this is fine. However each cell that loads also requires an individual API call to fill it out with more information. I'm finding that this causes the UITableView to "stutter" when scrolling? What is the best way to implement the additional API calls to preven...

How can I create a hardware-accelerated image with Java2D?

I'm trying to create a fast image generator that does lots of 2d transformations and shape rendering, so I'm trying to use a BufferedImage and then acquire the Graphics2D object to perform all my drawing. My main concern now is to make is really fast so I'm creating a BufferedImage like this: GraphicsEnvironment ge = GraphicsEnvironment...

Aligning doubles on 8-byte boundaries?

Is there a common portable idiom in numerics code (I'm writing in D, but language-agnostic, C and C++ answers would be useful to me, too) to ensure that all stack-allocated doubles that are accessed frequently are aligned on 8-byte boundaries? I'm currently optimizing some numerics code where misaligned stack-allocated doubles (only ali...

Is System.Threading.Timer efficient enough for thousands of concurrent timers?

I'm working on a request timeout mecanism. My initial approach would be to create one System.Threading.Timer for each request. The number of concurrent requests could scale up to thousands. I'm wondering if I should instead create a TimeoutScheduler that would internally use only one timer instead of having one per request. Can anyone ...

Performance Counter?

I would like to monitor the performance of the Memory (RAM) and Physical Disk, what are all the counters in Perfmon that I have to monitor? ...

jQuery code organization and performance

After doing some research on the subject, I've been experimenting a lot with patterns to organize my jQuery code (Rebecca Murphy did a presentation on this at the jQuery Conference for example). Yesterday I checked the (revealing) module pattern. The outcome looks a bit reminiscent of the YUI syntax I think: //global namespace MyNameSp...

Are 64 bit programs bigger and faster than 32 bit versions?

I suppose I am focussing on x86, but I am generally interested in the move from 32 to 64 bit. Logically, I can see that constants and pointers, in some cases, will be larger so programs are likely to be larger. And the desire to allocate memory on word boundaries for efficiency would mean more white-space between allocations. I have al...

What's a good approach to separate JavaScript-based plugins and configurations for performance improvement

Hi! I'm working on a high traffic web application that uses increasingly more JavaScript-based plugins. Improving and keeping front-end performance at high levels is a great concern for me. I want to rearchitect the way plugins and specific plugin configurations are included in the page. Currently some plugins are merged into a monolit...

Do you take a disk "hit" every time you retrieve a web.config value?

I have the following line of code called very often: var configValue = System.Configuration.ConfigurationManager.AppSettings["ConfigValueKey"]; Do I take a disk hit for ASP.Net to retrieve the item from the web.config, or is it smart enough to cache the value in memory and only refresh the cache when the web.config changes? ...

java short,integer,long performance

i read that JVM stores internally short, integer and long as 4 bytes. this was an article from year 2000 so i don't know how true it is now. for the newer JVMs is there any performance gain in using short over integer/long? and did that part of the implementation change since 2000? thanks ...

Stored procedure performs terribly - increase timeout or fix the problem

I've inherited a front end written by a third-party. That front end interacts with Oracle through procedures written by a different third-party. The stored procedure in question requires 2 minutes and 36 seconds to return search results when it is manually executed. I can't see the procedure and that team has suggested that I increase...

Massive amount of object creation in C++

Is there any pattern how to deal with a lot of object instantiations (40k per second) on a mobile device? I need these objects separately and they cannot be combined. A reusage of objects would probably be a solution. Any hints? ...

C# quickest way to shift array

How can i quickly shift all the items in an array one to the left, padding the end with null? [0,1,2,3,4,5,6] would become [0,2,3,4,5,6,null] Edit: I said quickly but I guess I meant efficiently. I need to do this without creating a List or some other data structure. This is something I need to do several hundred thousand times in as s...

Memory allocation for a class that has deep inheritance in .NET

If I have classes A, B, C, D, E, and interfaces like X, Y, Z, and model a system like: class B : A, X class C : B, Y class D : C, Z class E : D If A is an abstract base class and E is the class of interest, when I create an instance of E, would it in turn create instances of A, B, C, D, X, Y, Z in addition to E? If that's the case, w...