performance

What's the fastest way to deserialize a tree in C++

I'm working with a not so small tree structure (it's a Burkhard-Keller-Tree, > 100 MB in memory) implemented in C++. The pointers to the children of each node are stored in a QHash. Each node x has n children y[1] ... y[n], the edges to the children are labeled with the edit distance d(x, y[i]), so using a hash to store the nodes is an...

Python performance characteristics

I'm in the process of tuning a pet project of mine to improve its performance. I've already busted out the profiler to identify hotspots but I'm thinking understanding Pythons performance characteristics a little better would be quite useful going forward. There are a few things I'd like to know: How smart is its optimizer? Some moder...

Improving performance of merging lots of sorted maps into one sorted map - java

I have a method that gets a SortedMap as input, this map holds many SortedMap objects, the output of this method should be one SortedMap containing all elements of the maps held in the input map. the method looks like this: private SortedMap mergeSamples(SortedMap map){ SortedMap mergedMap = new TreeMap(); Iterator sampleIt = map.va...

MySQL query performance on two indexes + sorting

Hi, I'm implementing the following access policy: a User can access a Resource if he created it, belongs to the Resource's group members or if the resource is publicly available. Here is my DB structure (tables are MyISAM): User (1K-10K Users) id nickame … index user_name(id, nickname) Group (1K) id … Resource (10K-100K) ...

Does SET NOCOUNT ON really make that much of a performance difference

In this article, the author suggests that there is material overhead associated with SET NOCOUNT ON and that "By removing this extra overhead from the network it can greatly improve overall performance for your database and application" The author references a change in the default stored procedure template from 2000 to 2005 and suggest...

Is there a generally acceptable definition of (soft) realtime delays?

Hi, I'm trying to find a benchmark for how long users are willing to wait for a response from a remote service. In my case the response is for very useful but not business critical validation of data entry. I guess that there must have been some work done in the HCI space on this. If you know of a generally accepted definition for soft...

Performance/Accessibility issues in this jQuery/HTML code?

The following code works just fine in IE, FF, Chrome and Safari, but I am wondering how efficient it actually is when scaled to a lot of users and whether it is accessible to screen readers/special needs users/etc? Specifically, is there a better way to write the jQuery so it uses less $(this) references, and does that even cause any pe...

What are the performance implications of passing structs in an array by reference in C#

I'm working on a piece of code in C# / XNA where I'm highly concerned with performance. Part of this is passing several structs that are stored in arrays to various functions. Before this is asked, these are indeed supposed to be structs, not classes. They're essentially value types, and they need to (basically) live on the stack. Th...

Searching Subdirectories in C#

I have a list of file names, and I want to search a directory and all its subdirectories. These directories contain about 200,000 files each. My code finds the the file but it takes about 20 minutes per file. Can someone suggest a better method? Code Snippet String[] file_names = File.ReadAllLines(@"C:\file.txt"); foreach(string fil...

SQL Indexing - Computed Column vs Field Used by Computed Column

Quick question for the DBA's out there: Say I have 2 columns on my table, IsDeleted (bit) and DeletedDate (datetime). The table contains approx 10,000,000 rows. IsDeleted is a computed column that checks to see if DeletedDate is NULL; and it returns 1 if it is not, and 0 if it is. Querying this table will mainly be done on the IsDele...

How do you query for comments stackoverflow style?

I saw this question on meta: http://meta.stackoverflow.com/questions/33101/how-does-so-query-comments I wanted to set the record straight and ask the question in a proper technical way. Say I have 2 tables: Posts id content parent_id (null for questions, question_id for answer) Comments id body is_deleted post...

Telerik RadGrid Add/Edit Row Performance Issue

In a Telerik RadGrid, the user has the ability to add a row and edit an existing one. It appears that the grids actually force a postback to occur before the UI controls are rendered on the screen. I'm noticing a second to two seconds delay from the time the button is clicked to the time the controls appear. This seems about a second ...

PHP Try and Catch for SQL Insert

I have a page on my website (high traffic) that does an insert on every page load. I am curious of the fastest and safest way to (catch an error) and continue if the system is not able to do the insert into MySQL. Should I use try/catch or die or something else. I want to make sure the insert happens but if for some reason it can't I ...

Low-latency, large-scale message queuing

I'm going through a bit of a re-think of large-scale multiplayer games in the age of Facebook applications and cloud computing. Suppose I were to build something on top of existing open protocols, and I want to serve 1,000,000 simultaneous players, just to scope the problem. Suppose each player has an incoming message queue (for chat a...

Performance increase using Smarty + Caching?

Hey, I am going to start using codeigniter, but since it only offers to cache everything or nothing (which would not work, because I have logins, and other areas which cannot be cached) I was wondering whether it is a good idea to use Smarty. The only concern I have in this question is speed. (No yes/no smarty general question.) My Qu...

XLinq vs. SqlDataReader performance

As a part of trying to repair stuff in a fairly messed up legacy system I have a method making a call to a stored procedure in our SQLServer database. Nothing in this set up is ideal, but it is what I have got to work with. The two options I have is to use a SqlDataReader to read the stream as rows from the database, or to be handed the ...

Problems with a Union Query with an image/varbinary field

I'm having some problems with the following Query: SELECT v.idnum ,v.full_name ,convert(varbinary(max),s.signature) as Sig FROM AppDB.dbo.v_People1 AS v INNER JOIN OtherDB.dbo.Signatures AS s ON v.idnum = s.idnum UNION SELECT v.idnum , v.full_name , convert(varbinary(max), s.signatu...

Java Method invocation vs using a variable

Recently I got into a discussion with my Team lead about using temp variables vs calling getter methods. I was of the opinion for a long time that, if I know that I was going to have to call a simple getter method quite a number of times, I would put it into a temp variable and then use that variable instead. I thought that this would be...

Tuning MySQL for speedy column/index creation during development

Assume a MySQL MyISAM table with one gigabyte of data and one gigabyte of indexes. Furthermore, assume that during development columns and indexes will be added and removed from/to the table quite frequently. Due to the size of the database the column/index creation is slow when using the standard non-tuned MySQL settings. Which MySQL ...

Improving performance on a view with a LOT of joins...

I have a view that uses 11 outer joins and two inner joins to create the data. This results in over 8 million rows. When I do a count (*) on the table it takes about 5 minutes to run. I'm at a loss as to how to improve the performance of this table. Does anyone have any suggestions on where to begin? There appear to be indexes on al...