performance

Pros/cons to using char for small integers in C

Is there any disadvantage to using char for small integers in C? Are there any advantages other than the occupancy/memory benefit? In particular, is the processor likely to cope with integer arithmetic on a char better or worse than it would on a (long/short) int? I know this will be processor/system/compiler specific, but I'm hoping f...

MySQL count rows performance

For an InnoDB storage is it better to count the total number of records with `select * from tbl where pk = 1` <em>retrieve mysql_num_rows</em> or with `select count(*) as total from tbl where pk = 1` *fetch the array and retrieve the "total" value* ? ...

Memory alignment on modern processors?

I often see code such as the following when, e.g., representing a large bitmap in memory: size_t width = 1280; size_t height = 800; size_t bytesPerPixel = 3; size_t bytewidth = ((width * bytesPerPixel) + 3) & ~3; /* Aligned to 4 bytes */ uint8_t *pixelData = malloc(bytewidth * height); (that is, a bitmap allocated as a contiguous bloc...

Performance cost of Java dynamic proxy

Many modern frameworks (Spring, Hibernate) provide very nice dynamic behaviors with use of Java dynamic proxies, but what's the exact performance cost associated with it? Are there public benchmarks available for Sun JVM? ...

Does ASP.NET MVC perform better under IIS7 versus IIS6?

I'm running my ASP.NET MVC app on an IIS6 host right now, and they're not willing to upgrade my server, nor move my site to an IIS7 server - unless I purchase a new account to transfer to. Under IIS6 I understand there are a lot of wildcard mappings happening to get the .net framework to process the incoming connections for each type. ...

JPA/ORM vs JDBC for performance limited machines

We are creating a small application that will be deployed to very limited machines. They have only 256mb of RAM. I would like to use JPA as it simplifies the code and removes the need for JDBC ResultSet code. However, will the overhead of JPA on such small machines be a factor? I am thinking of using Toplink at the moment, which comes i...

When should one be careful using a bitset in place of a bool array?

I'm working on a mobile phone application and I see a potential opportunity for performance improvement. Throughout the code I use bool arrays to keep track of which objects are active. For example I'd check to see if the ith MyObject is active by doing the following: if(activeMyObjects[i]){ // it's active so do something... } Since...

C# - Default library has better performance?

Hello, Earlier today i made myself a lightweight memory stream, which basically writes to a byte array. I thought i'd benchmark the two of them to see if there's any difference - And there was: (writing 1 byte to the array) MemoryStream: 1.0001ms mine: 3.0004ms Everyone tells me that MemoryStream basically provides a byte array and a ...

Techniques to speed up Magento on a shared host

I have an established Magento site that is only just starting to get complaints about it's performance. It's on a shared server. The internal server-side cache is also enabled. Some of the problems I have noticed are Many HTTP Requests No minification of CSS or JavaScript. No CSS sprites Shared server isn't recommended for Magento, o...

LINQ to SQL throws exceptions when stress tested

I have this web app that is running ASP .NET MVC 1.0 with LINQ 2 SQL I'm noticing a very strange problem with LINQ 2 SQL throwing exceptions (mainly Specified cast invalid or Sequence contains more than one element) when under a certain amount of load. The bigger problem is, I'm not talking about Real Heavy/Professional Stress Testing....

performance of table access

Hi, we are having an application which is completely written in C. for table accessing inside the code like fetching some values from atable we use pro*C and for increasing the performance of the application we also preload some tables for fetching the data.we take some input fields and fetch the output fields from the table in general....

C++/CLI performance gain

I started long ago with plain C, then moved to C++ and now I'm facing C++/CLI. As a performance freak, I'm always trying to squeeze the last drop of performance to every line of code. I'm currently in a project that makes sense to be done mostly in VB.Net (simplicity, resource availability, etc.), but has a few points that are very perfo...

Why this performance difference? (Exception catching)

After reading a question here about what things our computer could do in one second I made a little test I had in mind for a while and I'm very surprised by the results. Look: Simple program to catch a null exception, takes almost one second to do 1900 iterations: for(long c = 0; c < 200000000; c++) { try { test = null;...

Extremely Slow Performing SELECT

I have a table with with 7,526,511 records with the following definition: /****** Object: Table [dbo].[LogSearches] Script Date: 12/07/2009 09:23:14 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[LogSearches]( [ID] [numeric](18, 0) IDENTITY(1,1) NOT NULL, [Acct_ID] [int...

R performance with data reshaping

I am trying to reshape a data frame in R and it seems to have problems using the recommended ways of doing so. The data frame has the following structure: ID DATE1 DATE2 VALTYPE VALUE 'abcd1233' 2009-11-12 2009-12-23 'TYPE1' 123.45 ... VALTYPE is a strin...

.NET String performance question

Is it better, from a performance standpoint, to use "Example1"? I'm assuming that "Example2" would create a new string on the heap in each iteration while "Example1" would not... Example1: StringBuilder letsCount = new StringBuilder("Let's count! "); string sep = ", "; for(int i=; i< 100; i++) { letsCount.Append(i + sep); } Exa...

Assembly Language & Compiled Languages

How is assembly faster than compiled languages if both are translated to machine code. I'm talking about truly compiled languages which are translated to machine code? Not C# or Java which are compiled to an intermediate language first and then compiled to native code by a software interpreter etc. In Wikipedia, I found something which ...

Custom captcha design

Hi there, I currently ran into the issue that I do not have the money to buy/rent any professional captchaing service. So I tried to look around for OS captcha generators, and captcha designs. I also had a brief brainstorm about my own and simple captcha design. Do you have any preferences, or can give me a good advice handling captch...

Modeling distribution of performance measurements

How would you mathematically model the distribution of repeated real life performance measurements - "Real life" meaning you are not just looping over the code in question, but it is just a short snippet within a large application running in a typical user scenario? My experience shows that you usually have a peak around the average exe...

Performance of VIEW vs. SQL statement

I have a query that goes something like the following: select <field list> from <table list> where <join conditions> and <condition list> and PrimaryKey in (select PrimaryKey from <table list> where <join list> and <condition list>) and PrimaryKey not in (select PrimaryKey from <table list> where <join list> and <condi...