performance

SQLEXPRESS: Suitability for Production Websites for Read Mostly Data

Has anybody used a local instance of SQLEXPRESS on a web server for serving up read only/mostly content? It seems a read-only database with no referential integrity, denormalized tables, indexes galore, etc. could perform well. Is this a completely horrible idea? And if so, why? ...

In jQuery, what's the fastest way to select a group of elements?

Hi, I need to add a onClick event to a around 10-20 elements on a page. What would be the fastest way to reference those elements? Would it be using: 1) class reference 2) ID reference Or a more drilled down reference like: p -> div -> li ? I realize we are probably talking a very small performance gain, but I think its good to know...

Efficient way to delete a line from a text file

I need to delete a certain line from a text file. What is the most efficient way of doing this? File can be potentially large(over million records). UPDATE: below is the code I'm currently using, but I'm not sure if it is good. internal void DeleteMarkedEntries() { string tempPath=Path.GetTempFileName(); using (var reader = new...

C#: Is ObjectTrackingEnabled = false worth it for small operations?

Given the following piece of code: using(var data = new SomeDataContext(ConnectionString)) { data.ObjectTrackingEnabled = false; foreach(Something in data.Somethings) someList.Add(something.SomeProperty); } Is it worth it setting object tracking to false? I know it is just one line of code, but it kind of bugs me having to w...

Ignoring a NULL parameter in T-SQL

I want to be able to pass in a list of parameters, and ignore the ones which are NULL. So that the query is in effect pretending that the filter isn't there and ignoring it. I was doing it like this: (@thing IS NULL or Thing=@thing) Is this right, and if so, would it perform badly? It's seems to be a lot slower than constructing the...

Tracking the script execution time in PHP

PHP is obviously tracking the amount of CPU time that a particular script has used (to enforce the max_execution_time limit). Is there a way to get access to this inside of the script? I'd like to include some logging with my tests about how much CPU was burnt in the actual PHP (the time is not incremented when the script is sitting an...

Performance tool for MySQL and Oracle?

I'm looking for a performance tool for testing of load in terms of data and number of users. This tool must support Oracle and MySQL. PS: I've tried DBtuna and Spotlight. ...

Slow query / disable cache - Sybase Adaptive Server

This query seems to be running incredibly slow (25 seconds for 4 million records!) on Sybase v10 at a clients database: Select max(tnr) from myTable; With tnr being the primary key. If I run it 1000x on our server however, it seems to go fast (15 ms...) which makes me think it's because the query result is cached. Is there a way to d...

What's a good profiling tool to use when source code isn't available?

I have a big problem. My boss said to me that he wants two "magic black box": 1- something that receives a micropocessor like input and return, like output, the MIPS and/or MFLOPS. 2- something that receives a c code like input and return, like output, something that can characterize the code in term of performance (something like the ne...

Reserve memory for list in Python?

When programming in Python, is it possible to reserve memory for a list that will be populated with a known number of items, so that the list will not be reallocated several times while building it? I've looked through the docs for a Python list type, and have not found anything that seems to do this. However, this type of list buildin...

Performance / stability of a Memory Mapped file - Native or MappedByteBuffer - vs. plain ol' FileOutputStream

I support a legacy Java application that uses flat files (plain text) for persistence. Due to the nature of the application, the size of these files can reach 100s MB per day, and often the limiting factor in application performance is file IO. Currently, the application uses a plain ol' java.io.FileOutputStream to write data to disk. ...

File Copying optimization through multiple threads

Can you make file copying faster through multiple threading? Edit: To clarify, suppose you were implementing CopyFile(src, tgt). It seems logical that under certain circumstances you could use multiple threads to make it go faster. Edit Some more thoughts: Naturally, it depends on the HW/storage in question. If you're copying from on...

Managed vs Unmanaged

What are your thoughts about them? Sometimes I have to write unmanaged code at work, but with large scale (games) projects, it just becomes way more time-consuming and complicated, which is solved by throwing more people at it. Do you think managed code is viable for large scale applications? (applications like Photoshop, 3ds Max, Maya...

Does .NET JIT optimize empty loops away?

This article suggests otherwise. But there is still a need to evaluate the loop condition. Does java just employ a specific trick to recognize this case? ...

Emulating variable bit-shift using only constant shifts?

I'm trying to find a way to perform an indirect shift-left/right operation without actually using the variable shift op or any branches. The particular PowerPC processor I'm working on has the quirk that a shift-by-constant-immediate, like int ShiftByConstant( int x ) { return x << 3 ; } is fast, single-op, and superscalar, whereas...

How does .NET make use of IO Threads or IO Completion Ports?

We have a .NET application that makes several concurrent calls to various web services, collects their responses and then makes a few calculations off those responses. In attempting to derive additional performance, I've been investigating the use of approaches that make use of .NET's IO threading via the use of IO completion ports. I've...

Maintaining video website performance

I am setting up a online video playing web site (like Youtube). My technical challenge is to serve a lot of hits and still maintain performance. My current solution is to set up several back-end servers, having each server cache a part of the video which could save the time to read the video file from disk I/O. Another front-end server...

Efficiently retrieving and filtering files.

This earlier SO question talks about how to retrieve all files in a directory tree that match one of multiple extensions. eg. Retrieve all files within C:\ and all subdirectories, matching *.log, *.txt, *.dat. The accepted answer was this: var files = Directory.GetFiles("C:\\path", "*.*", SearchOption.AllDirectories) .Wh...

A 90/10 Rule for Memory Management?

Most programmers agree that garbage collection is a great thing, and in most applications is well worth the overhead. However, my personal observation is that memory management for most objects is trivial, and maybe 10%-20% of them account for the need for kludges such as reference counting and really complicated memory management schem...

Best Way To Prepare A Read-Only Database

We're taking one of our production databases and creating a copy on another server for read-only purposes. The read-only database is on SQL Server 2008. Once the database is on the new server we'd like to optimize it for read-only use. One problem is that there are large amounts of allocated space for some of the tables that are unuse...