performance

Is it faster to UPDATE a row, or to DELETE it and INSERT a new one?

Given two scenarios on SQL Server 2008/2005 - 1 Table has 5 rows 2 Table has 1 million rows If we need to update a few rows, what is is efficient and why? 1) UPDATE the required columns 2) DELETE the row and INSERT new row with the updated information ...

Iphone Cocos2D - SpriteSheet Cocos2D (so confused...)

I have gotten 0 response from the Cocos2D board so thought Id try here. Ok. Im ripping out my hair over this. I did a complete re-haul of my code last night in hopes of fixing some iphone4 framerate issues. I created sprites in advance instead of doing some of the creation during the update methods. I only add them to the spritesheet no...

Why WPF UserControl's performance is so difference host into Wfp application and win form application?

This is my question: 1.I have 200,0000 Employee object(Id,Name,Job,Address) store at a database. 2.I read all Employee object to Empolyee[]. 3.I create a window form application (1) I create a WPF UserControl(inside ListBox),name is "wpfUserControl1". (2) I put "wpfUserControl1" into a window form. (3) I set wpfUserControl1.listBox...

Large table querying

Hello, I have a database table that accepts more than 2,000,000 records each month. I have created it as a partitioned table. All searchable fields are indexed. But when applying a paging select on the table by the with keyword it takes long time to get the result. Is there any other solution to tune this table's performance? ...

run native(unmanaged) exe from memory in C#

hello i have some c program that use from those in my c# program. i dont want send those c exe to client. that mean i dont want user can see those exe. i want to load those byte to memory and run its from memory. how i can do that. thanks a lot. ...

Best index for multiple variables to avoid an OR

hello all, i am building an application that will behave more or less like google adwords and i am at the point where i build the impression engine. we will have campaigns running based on geolocation of the user. based on his IP we will determine his state, city, approximate lat/long. on the other side we will have ads running on differ...

What is this cProfile result telling me I need to fix?

I would like to improve the performance of a Python script and have been using cProfile to generate a performance report: python -m cProfile -o chrX.prof ./bgchr.py ...args... I opened this chrX.prof file with Python's pstats and printed out the statistics: Python 2.7 (r27:82500, Oct 5 2010, 00:24:22) [GCC 4.1.2 20080704 (Red Hat 4...

How to find the closest 2 points in a 100 dimensional space with 500,000 points?

I have a database with 500,000 points in a 100 dimensional space, and I want to find the closest 2 points. How do I do it? Update: Space is Euclidean, Sorry. And thanks for all the answers. BTW this is not homework. ...

How to draw a background fast in cocos2d?

I'm toying with a small game on my iPad using cocos2d and I've run into some performance worries. I have a 512x512 image tiled as my background. That gives me around 40fps with 20 sprites (in a CCSpriteBatchNode), the code for the background is this: CCSprite *background; background = [CCSprite spriteWithFile:@"oak.png" rect : CGRectMa...

Performance comparison of immutable string concatenation between Java and Python

UPDATES: thanks a lot to Gabe and Glenn for the detailed explanation. The test is wrote not for language comparison benchmark, just for my studying on VM optimization technologies. I did a simple test to understand the performance of string concatenation between Java and Python. The test is target for the default immutable String obj...

c++ performance issue beginner (size function in for loop)

hi when having a vector<int> var; for(int i=0; i< var.size();i++) , is the size() function called each time or only once ? from the answers I guess I better use iterators , or just have variable before the loop ...

Monitoring application to track performance of .net service in production?

Is there anything similar to appdynamics.com to track performance and errors of a .net service in production? I'd love to have an easy to integrate dashboard to monitor Number of calls per minute Response time Cpu / Memory usage GC behaviours Exceptions Alerts if anything is out of scale (actual response time vs avg, etc..) ...

Scrolling performance and UIImage drawing

I'm building a UITableView similar to iPod.app's album browsing view: http://cl.ly/2mWo I'm importing all the artists and album artworks from the iPod library on first launch. Saving everything to CoreData and getting it back into an NSFetchedResultsController. I'm reusing cell identifiers and in my cellForRowAtIndexPath: method I have ...

Why misaligned address access incur 2 or more accesses?

The normal answers to why data alignment is to access more efficiently and to simplify the design of CPU. A relevant question and its answers is here. And another source is here. But they both do not resolve my question. Suppose a CPU has a access granularity of 4 bytes. That means the CPU reads 4 bytes at a time. The material I li...

Slow MySQL Query

I have tried everything to make this query faster that I know of. Same engine for every table, indexes on all the fields which are used for joins, order by or where clauses. The problem seems to be tables aam and ag are not using an index despite there being indexes available. Query: SELECT DISTINCT `a`.`id`, `a`.`full_name`, `a`....

WPF Performance Issue

We have quite some performance issue in our wpf application. The application itself is a WinForms app that is using ElementHost to host smaller wpf-applications. In one of the smaller apps we have a listbox that are using UserControls as items. When we do some performance-testing on this app feeding it with 1000 items and filtering the i...

Avoiding casting multiple times.

Hello guys. I have a method which receives a parameter of base type and performs some pre-processing depending on actual parameter type. Here is my code: public void OnMessageReceived(QuickFix42.Message message) { if (message is QuickFix42.ExecutionReport) { ProcessExecutionReport(message as QuickFix42.ExecutionReport);...

Books about performance management

I'm currently working on performance management for a bigger application. The application itself is written in Java, but it is clear that our performance problems lay not only in Java alone. I would like to read about managing the performance of a whole system, not only the database or Java on the application server. I have found some n...

Sort or RemoveAll first on an IEnumerable that needs both?

When an IEnumerable needs both to be sorted and for elements to be removed, are there advantages/drawback of performing the stages in a particular order? My performance tests appear to indicate that it's irrelevant. A simplified (and somewhat contrived) example of what I mean is shown below: public IEnumerable<DataItem> GetDataItems(in...

jQuery Selectors: Which is faster for grabbing a subset of children?

Following up on this question, I have the following 2 options: $("tr td").slice(3, 6); And possibly something like this (algorithmically speaking, I mean; I know making new query strings for each element is kinda silly): var subset = $( "tr td:nth-child(4)" ); for(var i=4; i<7; i++) subset.add( "tr td:nth-child("+i+")" ); Which wou...