performance

vector or map, which one to use?

I've heard many people saying that if the number of elements expected in the container is relatively small it is better to use std::vector instead of std::map eventhough I use the container for only lookup and not for iterating. What is the real reason behind this ? Obviously the lookup performance of map can not be worse than that of th...

Performance of Arrays vs. Lists

Say you need to have a list/array of integers which you need iterate frequently, and I mean extremely often. The reasons may vary, but say it's in the heart of the inner most loop of a high volume processing. In general, one would opt for using Lists (List) due to their flexibility in size. On top of that, msdn documentation claims List...

Should I COUNT(*) or not?

I know it's generally a bad idea to do queries like this: SELECT * FROM `group_relations` But when I just want the count, should I go for this query since that allows the table to change but still yields the same results. SELECT COUNT(*) FROM `group_relations` Or the more specfic SELECT COUNT(`group_id`) FROM `group_relations` I...

How to measure code performance in .NET?

I'm doing some real quick and dirty benchmarking on a single line of C# code using DateTime: long lStart = DateTime.Now.Ticks; // do something long lFinish = DateTime.Now.Ticks; The problem is in the results: Start Time [633679466564559902] Finish Time [633679466564559902] Start Time [633679466564569917] Finish Time [63367946656456...

Is there a way to speed up GetAccessControl and GetOwner

I'm going through a lot of files and on each file I need to obtain owner sid and owner ntaccount. I do this by using GetAccessControl() and GetOwner() which works great, exception for one thing. It's unbeliable slow and as far as I can see it's using a shared resource which mean I can't increase performance by using more threads. Right n...

Telerik RadGrid working examples

I'm looking for some examples of production websites that currently use the Telerik Rad Grid. I'd really like to see some real world scenarios in action, other than the Telerik RadGrid demo. Does anyone know of any websites that use it? ...

jQuery animate() and browser performance.

I've got some elements that I'm moving across the page very slowly. Essentially, I'm decreasing the left margin of two images over a span of 40 seconds or so. Visually, it's working beautifully. However, my processor jumps to about 50% usage during the animations. This isn't specific to any single browser either- it's the same way on S...

Algorithm to Find the pointer to the Node M Steps to Tail in a Singly Linked List

Suppose there is a singly linked list whose length is unknown. We want to find the node with M steps to the tail. For example, the singly list is like this: (A)->(B)->(C)->(X)->(Y) and M = 2. Then the output should be pointer to (C). When confronting this quiz, my first reaction is to traverse the singly linked list to get the length N...

Django: Generating a blog's active entry list. Is this efficient?

The following query does what I'd like it to do, however, I have no idea if it's efficient. I went through the Django aggregation documentation, threw it together, looked at the query and tilted my head sideways like a confused dog. What the query actually does is get published Entry's "name" and "name_slug" that have one or more approv...

Compact Framework and JIT. How long could it take

We have/had a phantom delay in our app. This was traced to the initialisation of a singleton when the object was touched for the first time and was blamed on JIT. I'm not utterly convinced by this as there is no mechanism for measuring JIT (or is there?) and the entire delay was seven seconds. Seven seconds of JIT?!? Could that be forrea...

Is this an efficient sql server query?

Hi, If I write a sproc in this format, will sql server do this effeciently or should the sql 'weaving' be done on the server side (.net)? Note: this is just a rough idea of what my query looks like, there are more 'if' clauses the build up my query that I execute using 'exec' declare @sql nvarchar(4000) declare @order nvarchar(4000) ...

Performance Tuning SQL - How?

How does one performance tune a SQL Query? What tricks/tools/concepts can be used to change the performance of a SQL Query? How can the benefits be Quantified? What does one need to be careful of? What tricks/tools/concepts can be used to change the performance of a SQL Query? Using Indexes? How do they work in practice? Normalis...

What are the benefits of List<T>.Find over alternatives?

Recently I used a predicate to describe search logic and passed it to the Find method of a few Lists. foreach (IHiscoreBarItemView item in _view.HiscoreItems) { Predicate<Hiscore> matchOfHiscoreName = (h) => h.Information.Name.Equals(item.HiscoreName); var current = player.Hiscores.Find(matchOfHiscoreName); item.Ge...

XSLT with Xalan vs. STX with Joost

Where can I find performance metrics (memory/time) for a non-trivial example of using XSLT (with Xalan) compared to using STX (with Joost) ...

What is your opinion about using Web-Services to get big lists of data ?

I had some sessions with developers about getting list of data with Web-Services, they said it's depend on the type of the site, commerce, blog etc. What is your opinion on the subject ? Is using a Web-Service for getting big list of data is a smart way performance wise? ...

Simple bandwidth / latency test to estimate a users experience.

I write web based applications. Performance is obviously a key factor. Whilst database load and page rendering time are things I have control of, the users internet connection is not. What I'm looking for is a way to indicate what sort of a connection a user has. Something along the lines of a traffic light in the corner of a website th...

Is there a performance hit by added nonenforced foreign keys to a SQL Server 2008 database?

I'm working with a database and I want to start using LINQ To SQL with it. The database doesn't have any FKs inside of it right now for performance reasons. We are inserting millions of rows at a time to the DB which is why there aren't any FKs. So I'm thinking I'm going to add nonenforced FKs to the database to describe the relationshi...

Is there any performance difference between ++i and i++ in C#?

Is there any performance difference between using something like for(int i = 0; i < 10; i++) { ... } and for(int i = 0; i < 10; ++i) { ... } or is the compiler able to optimize in such a way that they are equally fast in the case where they are functionally equivalent? Edit: This was asked because I had a discussion with a co-work...

Sample a running Python app

Hi. I'm used to sampling C-based apps, which every few milliseconds sees what function stack is being called at that moment. This allows me to see where most of the time is spent in an app so I can optimize it. When using python, however, sample isn't so helpful, since it's sampling the C functions of the python interpreter, not the py...

How can I measure the size of the object I send over RMI?

I'm doing some performance tuning on my application and would like to know a good way of measuring the size of the object that I am sending over RMI. The aim is to make my object leaner. ...