performance-comparison

Why Java is running faster than C here?

Inspired by this question, Now visible only for users with > 10k rep I came up with the following code: $cat loop.c int main( int argc, char ** argv ) { int i = 0; while( i++ < 2147483647 ); } $cc -o loop loop.c $ time ./loop real 0m11.161s user 0m10.393s sys 0m0.012s $cat Loop.java class Loop { public static v...

Which is quicker COALESCE OR ISNULL ?

I understand the difference between these functions but my question is when checking for a single null value would ISNULL be any quicker than using COALESCE? e.g COALESCE(SELECT TOP 1 SomeValue FROM SomeTable, 0) vs ISNULL(SELECT TOP 1 SomeValue FROM SomeTable, 0) ...

ASP.net vs PHP - performance, future-proofing & ease of development

I was asked yesterday by a client whether it was better for him to run his high-availability / throughput shopping site on ASP.net or PHP. He's ready to make a "Ten Year Decision," so he needs to know that the platform he picks will continue to be well supported and that developers will be available with the skills to work on it. I've ...

What's the best way to 'indicate/numerate' performance of an application?

In the old (single-threaded) days we instructed our testing team to always report the CPU time and not the real-time of an application. That way, if they said that in version 1 an action took 5 CPU seconds, and in version 2 it took 10 CPU seconds, that we had a problem. Now, with more and more multi-threading, this doesn't seem to make...

Comparing performance of software implementations

HI all, This is a more general question, but basically I wanna compare the performance of two multimedia software applications. Although they are doing the same thing, they are running on different platforms and also nothing is known about the implementation. I get quite some different performance figures and I am trying to reason about...

what is the best tool for performance regression testing

our organization is looking for a tool to help with performance testing on each release. We ship a whole bunch of new software and we want to ensure that performance on key functions has not slowed down since the last prod release. We have code in C# and Java. This can be anything from: when i run this function it takes < 2 seconds ...

Is it better to use fseek() fread() on individual lines, or fread() the entire file and substr to parse?

To make this more clear, I'm going to put code samples: $file = fopen('filename.ext', 'rb'); // Assume $pos has been declared // method 1 fseek($file, $pos); $parsed = fread($file, 2); // method 2 while (!feof($file)) { $data = fread($file, 1000000); } $data = bin2hex($data); $parsed = substr($data, $pos, 2); $fclose($file); T...

Performance comparison of array of arrays vs multidimensional arrays

When I was using C++ in college, I was told to use multidimensional arrays (hereby MDA) whenever possible, since it exhibits better memory locality since it's allocated in one big chunk. Array of arrays (AoA), on the other hand, are allocated in multiple smaller chunks, possibly scattered all over the place in the physical memory whereve...

SQL Index Question: Why does SQL Server prefer this NONCLUSTERED index to a CLUSTERED one?

I have the following query: SELECT COUNT(*) FROM FirstTable ft INNER JOIN SecondTable st ON ft.STID = st.STID As you can guess, "STID" is the primary key on "SecondTable"... and "FirstTable" will have a pointer to that second table. Here are the indexes that I have: FirstTable: NONCLUSTERED INDEX on column "STID" Sec...

Performance difference between gridview data binding vs looping in ASP.NET

How much difference will there be if I bind data to a gridview in comparison to a loop through the data and build out the Html? I am currently using an html table in the ItemTemplate of a gridview and have <%#Eval("ID")%> in that table to bind the data from iQueryable What if i loop through the IQueryable and build out html from the c...

Need advice on comparing the performance of 2 equivalent linq to sql queries

I am working on tool to optimize linq to sql queries. Basically it intercepts the linq execution pipeline and makes some optimizations like for example removing a redundant join from a query. Of course, there is an overhead in the execution time before the query gets executed in the dbms, but then, the query should be processed faster. I...

Is there a memory and performance hit taken from using Bloch's Builder Pattern?

What is the memory and performance usage compared to creating a object with only a constructor? The usage here is in creating a Set<Object> or List<Object> that may contain million plus entries and I am concerned with the overhead of using Bloch's Builder Pattern. I have used it in the past, but never in this large of a scope. Refer...

SQL Profiler: Read/Write units

i'm running a select query in Query Analyzer. While running SQL Profiler i see that the query took 2,027 reads: EventClass: SQL:BatchCompleted TextData: SELECT Transactions.... CPU: 422 Reads: 2027 Writes: 0 Duration: 466 i ran the query with the SET STATISTICS IO ON option, and i get nowhere clos...

How well does Scala Perform Comapred to Java?

The Question actually says it all. The reason behind this question is I am about to start a small side project and want to do it in Scala. I am learning scala for the past one month and now I am comfortable working with it. The scala compiler itself is pretty slow (unless you use fsc). So how well does it perform on JVM? I previously w...

Are there any resources for language independent performance tips?

I work with many people that program video games for a living. I have a quite a bit of knowledge in C++ and I know a number of general performance strategies to utilize in day to day programming. Like using prefix ++/-- over post fix. My problem is that often times people come to me to give them tips on general optimizations they can d...

Why do people say that Ruby is slow?

I like Ruby on Rails and I use it for all my web development projects. A few years ago there was a lot of talk about Rails being a memory hog and about how it didn't scale very well but these suggestions were put to bed by Gregg Pollack here. Lately though, I've been hearing people saying that Ruby itself is slow. Why is Ruby consi...

How much does precomputation (matching a series of strings and their permutations with a set number of other strings) help, especially over a network ?

Consider a typical slots machine with n reels(say reel1: a,b,c,d,w1,d,b, ..etc). On play we generate a concatenated string of n objects (like for above, chars) We have a paytable which lists winning strings with payout amounts. The problem is a wild character (list of wilds: w1,w2) which can replace {w1:a,b,c},{w2:a} ..etc. Is it reall...

Are ontology storage engines slower than RDMBS systems?

My intuition says that ontology engines like Triplestore or Seseme are going to be slower to query than a DB, but is that really the case? What is it that would make them so much slower? ...

Pros/cons of reading connection string from physical file vs Application object (ASP.NET)?

my ASP.NET application reads an xml file to determine which environment it's currently in (e.g. local, development, production). It checks this file every single time it opens a connection to the database, in order to know which connection string to grab from the Application Settings. I'm entering a phase of development where effic...

Divide and conquer method to compute roots [SOLVED]

Hello, Knowing that we can use Divide-and-Conquer algorithm to compute large exponents, for exemple 2 exp 100 = 2 exp(50) * 2 exp(50), which is quite more efficient, is this method efficient using roots ? For exemple 2 exp (1/100) = (2 exp(1/50)) exp(1/50) ? In other words, I'm wondering if (n exp(1/x)) is more efficient to (n exp(1/y)...