performance

Performance of enum conversion

Hi folks, after a bit speedtracing I found a piece of code (called very very often) which converts values of one enum to values of another enum, like this: public Enum2 ConvertToEnum2(Enum1 enum1) { switch(enum1) { case Enum1.One: return Enum2.One; break; case Enum1.Two: return Enum2.Two; ...

How well does F# perform compared to C#?

Of course both F# and C# compile to IL and the CLR JITter does most of the hard work, however I wanted to know whether there's anything implicit in the F# language or its core libraries which result in lesser performance compared to C#? Additionally, is there anything in the use of functional programming in the .net framework that might...

python string join performance

There are a lot of articles around the web concerning python performance, the first thing you read: concatenating strings should not be done using '+': avoid s1+s2+s3, instead use str.join I tried the following: concatenating two strings as part of a directory path: three approaches: '+' which i should not do str.join os.path.join H...

Heap versus Stack allocation implications (.NET)

From a SO answer about Heap and Stack, it raised me a question: Why it is important to know where the variables are allocated? At another answer someone pointed that the stack is faster. Is this the only implication? Could someone give a code example where a simple allocation location change could solve a problem (eg. performance)? Not...

What is the best way to handle sending many emails in Rails?

I know about persisting the email into the db and then letting some periodical job handle the actual sending. I know that ar_mailer gem does this. Are there any other approaches? Are there better alternatives? Simply, What is the best way to handle sending many emails in Rails? ...

Clear file cache to repeat performance testing

What tools are available to either completely clear, or selectively remove cached information about file and directory contents? The application that I'm developing is a specialised compression utility, and is expected to do a lot of work reading and writing files that the operating system hasn't touched recently, and whose disk blocks ...

How to perform Xperf callstack capture on 64b OS?

I have installed Xperf performance analyzer from Windows SDK and captured a trace as described in the documentation using following command: xperf -on SysProf -stackwalk profile Still, the stack trace does not contain any callstack data. My platform is Vista 64b. Are there any special settings or tricks needed to capture callstacks o...

Anyone have any opinions on DataTable.Load(DataReader) method?

Does anyone have any thoughts on this method? I have did some performance testing on it and it seems to perform worse than simply doing a dataadapter.fill call or just looping through the datareader and creating new rows for the table. Do people use this in production, or is this just another thing Microsoft gave us that we don't use? ...

Is there a performance benefit single quote vs double quote in php?

Are there any performance benefits to using single quotes instead of double quotes in php? In other words, would there be a performance benefit of: $foo = 'Test'; versus $foo = "Test"; G-Man ...

SQL latest record per foreign_key

I've got the following 2 tables: ingredients (id, name) ingredient_prices (id, ingredient_id, price, created_at) such that one ingredient can have many prices. What will be the best way to get the latest entered price per ingredient? I know it can be done easily with sub-selects, but I want to know if there is a more efficient way fo...

Fetching records with slug instead of ID

I'm currently trying to find the best way (in term of usability and performance) when dealing with a situation like fetching records tagged with a specific tag, or category, or something like that. A good way (the way I wanted to do), would be to fetch records with the tag/category slug, so the URL would look like : http://stackoverflo...

SQL Group By Year, Month, Week, Day, Hour SQL vs Procedural Performance

I need to write a query that will group a large number of records by periods of time from Year to Hour. My initial approach has been to decide the periods procedurally in C#, iterate through each and run the SQL to get the data for that period, building up the dataset as I go. SELECT Sum(someValues) FROM table1 WHERE deliveryDate BETWE...

ActionScript2 performance: Iterating over object attributes

Is there a performance hit when iterating over object attributes vs. iterating an array? Example, using objects: var x:Object = {one: 1, two: 2, three: 3}; for (var s:String in x) { trace(x[s]); } Vs using an array var a:Array = [1, 2, 3]; var len:Number = a.length; for (var i:Number = 0; i < len; ++i) { trace(a[i]); } So - whic...

Select "where clause" evaluation order

In Sql Server 2005 when I have multiple parameters do I have the guarantee that the evaluation order will always be from left to right? Using an example: select a from table where c=1 and d=2 In this query if the "c=1" condition fails the "d=2" condition will never be evaluated? PS- "c" is an integer indexed column, d is a large ...

Linux Socket Buffer Imbalance

I have a simple scenario, where two servers are connected through a gigabit link. I run iperf on both sides to measure the throughput. What surprises me, whenever I run the traffic bidirectionally, it always favor one side only (eg. ~900Mbps vs. ~100Mbps). If I run the traffic unidirectional, each side got ~900Mbps. If I connect one of...

SQL Server FTS performance after adding many records

We have a web application that allows clients to manage large lists of names. For searching on these lists, we use SQL Server 2008's FTS, which usually works well. Our largest client has 900,000 names and enjoys sub-second search times. For another new client, however, I recently imported 150,000 names, and performance is terrible (as i...

C/C++ Performance Globals vs Get/Set Methods

I saw this question asking about whether globals are bad. As I thought about the ramifications of it, the only argument I could come up with that they're necessary in some cases might be for performance reasons. But, I'm not really sure about that. So my question is, would using a global be faster than using a get/set method call? G-...

Hibernate Performance Tweaks

In your experience what are some good Hibernate performance tweaks? I mean this in terms of Inserts/Updates and Querying. ...

Highest Performance Database Storage Mechanism

I need ideas to implement a (really) high performance in-memory Database/Storage Mechanism. In the range of storing 20,000+ objects, with each object updated every 5 or so seconds. I would like a FOSS solution. What is my best option? What are your experiences? I am working primarily in Java, but I need the datastore to have good perf...

Understanding Users - Does Performance Trump Looks?

It seems to me that whenever a GUI (Graphical User Interface) is involved, the look and feel of the interface nearly always trumps the performance of the application. Is this a universal phenomenon? ...