performance

Array Performance/Optimization

I am reading a CSV file and I would like to cache the results in an array. This is my getter/setter: private RedirectionRule[] RedirectionRules { get { if (_redirectionRules == null) { return new RedirectionRule[MAXLENGTH]; } return _redirectionRules; } set { _re...

Why doesn't Python's mmap work with large files?

I am writing a module that amongst other things allows bitwise read access to files. The files can potentially be large (hundreds of GB) so I wrote a simple class that lets me treat the file like a string and hides all the seeking and reading. At the time I wrote my wrapper class I didn't know about the mmap module. On reading the docum...

Available RAM on shared hosting provider

I'm building business app that will hold somewhere between 50,000 to 150,000 companies. Each company (db row) is represented with 4-5 properties/columns (title, location,...). ORM is LINQ2SQL. I have to do some calculation, and for that I have lot of queries for specific company. Now, i go to db every time when i need something, and it ...

ASP.NET performance: counting SQL requests

We had huge performance problem when deploying our ASP.NET app at a customer, which had the DB sitting on a remote location. We found that it was due to the fact that pages made ridiculous amount of individual SQL queries to the DB. It was never a problem we noticed because usually, the web and DB are on the same local network (low late...

When to use EXCEPT as opposed to NOT EXISTS in Transact SQL?

Hi, I just recently learned of the existence of the new "EXCEPT" clause in SQL Server (a bit late, I know...) thru reading code written by a coworker. It truly amazed me! But then I have some questions regarding its usage: when is it recommended to be employed? Is there a difference, performance-wise, between using it versus a correlate...

.NET Applications performance problem on Windows 2003

Hi, We have a 2 x Quad Core Xeon server with 8GB of RAM and Windows Server 2003 Enterprise installed on it. We installed our application server which is based on .NET Framework 3.5 on it. The server uses SQL Server 2005 as its database server. When we installed the application server, it used to have ultra fast performance and everythi...

When is it best to use Static Functions in ASP.NET

Hi all, I have been wondering, When to use static functions and when not to in ASP.NET What are the advantages and disadvantages in using them, in various aspects like performance, following good practices etc (and many more, which ever you feel is relevant). Looking forward for your replies. Thanks, Mahesh Velaga. ...

FileStream very slow on application-cold start

A very similar question has also been asked here on SO in case you are interested, but as we will see the accepted answer of that question is not always the case (and it's never the case for my application use-pattern). The performance determining code consists of FileStream constructor (to open a file) and a SHA1 hash (the .Net framewo...

DataView.Sort is a performance bottleneck

I have a performance bottleneck on a DataView.Sort. The code is below. /// <summary> /// Filters the data table and returns a new data table with only the filtered rows. /// </summary> /// <param name="dtInput">The dt input.</param> /// <param name="filterExpression">The filter expression.</param> /// <returns><...

List<T> and ArrayList default capacity

I have been looking at .NET's List and ArrayList implementations with Reflector. When looking at the Add(T item) I ran across this.EnsureCapacity(this._size + 1): public void Add(T item) { if (this._size == this._items.Length) { this.EnsureCapacity(this._size + 1); } this._items[this._size++] = item; this._ve...

Is $1 or $& faster for replacing a matched string using s/// in Perl?

Which one of these is cheaper? $_ = 'abc123def'; s/\d+/$&*2/e; say; s/(\d+)/$1*2/e; say; ...

Apache Benchmark - Randomized querystrings?

heya, I need to benchmark a site, and was thinking of using ab (Apache Benchmark) to do it. We need to hammer it quite hard, and we're interested more in how our app will cope, as opposed to the network bandwidth, hence we're doing it from localhost. The other thing is, we need to pass in a random list of different query strings: i.e...

Generic suggestions for SQL 2005 Framework\Design and Implementation

I'm renovating an existing ASP.Net web-app which has a full-fledge functional SQL 2005 DB as its backend. By full--fledge functional I mean that there're many things (infact almost ALL the CRUD operations) that are being handled from within the DB using SP. So, my first question is that is an extensive usage of SP good based on paramete...

jQuery element[attribute=something] vs element.class performance

I am wondering which way would end up being faster, selecting elements by: $('element[href=#my_link]'); or: $('element.my_class'); I don't like repeating myself when I write code, so I prefer to write it the first way for the most part because then I can add information to it like: <a href="#delete_1">Delete</a> $('a[href^=#dele...

Fortran: 32 bit / 64 bit performance portability

I've been starting to use Fortran (95) for some numerical code (generating python modules). Here is a simple example: subroutine bincount (x,c,n,m) implicit none integer, intent(in) :: n,m integer, dimension(0:n-1), intent(in) :: x integer, dimension(0:m-1), intent(out) :: c integer :: i c = 0 do i = 0, n-1 c(x(i)) = ...

Is this Repository pattern efficient with LINQ-to-SQL?

I'm currently reading the book Pro Asp.Net MVC Framework. In the book, the author suggests using a repository pattern similar to the following. [Table(Name = "Products")] public class Product { [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)] public int ProductId { get;...

Framework Comparison and Overhead

I am working on a Facebook game which is developed using Zend framework. Right now I don't have lots of traffic and already seen quite a large # of data usage / CPU time. Actually, I'm not good at Zend. I good at coding from scratch for both PHP & JS. so, I am curious about the performance of Zend framework. becuase I'm thinking about...

Framework Comparison and Overhead

I am working on a Facebook game which is developed using Zend framework. Right now I don't have lots of traffic and already seen quite a large # of data usage / CPU time. Actually, I'm not good at Zend. I good at coding from scratch for both PHP & JS. so, I am curious about the performance of Zend framework. becuase I'm thinking a...

Oracle, how update statement works

Hi, Question 1 Can anyone tell me if there is any difference between following 2 update statements: UPDATE TABA SET COL1 = '123', COL2 = '456' WHERE TABA.PK = 1 UPDATE TABA SET COL1 = '123' WHERE TABA.PK = 1 where the original value of COL2 = '456' how does this affect the UNDO? Question 2 What about if I update a record in table ...

Performance cost of creating ObjectContext in every method in Entity Framework v1

Hello, While using .NET 3.5 SP1 in ASP.NET MVC application, the ObjectContext can have lifetime on one Http Request OR of a SINGLE method. using (MyEntities context = new MyEntities ()) { //DO query etc } How much is increased performance cost of creating ObjectContext in every method VS per request ? Thanks. ...