optimization

Ropes: what's "large enough to benefit from cache effects"?

From Wikipedia: The main disadvantages are greater overall space usage and slower indexing, both of which become more severe as the tree structure becomes larger and deeper. However, many practical applications of indexing involve only iteration over the string, which remains fast as long as the leaf nodes are large e...

finding performance bottlenecks in ASP.NET

We have MSSQL, some C# web services, some ASP.NET, and some AJAX. We're having terrible load times, normally 2-3 seconds to refresh a page, sometimes far more. I have no idea where to start. What profiling tools are there, across the entire end-to-end, to identify where the biggest bottlenecks are? ...

Is there any advantage in writing a set of operations in a single line if all those operations have to occur anyway?

From a post-compilation perspective (rather than a coding syntax perspective), in C#, is there any actual difference in the compiled code between a set of operations that have occurred on one line to a set of operations that occur across multiple lines? This object anObject = new object(); anObject = this.FindName("rec"+keyPlayed.ToStr...

Can I simplify/optimise this Jquery code at all?

Hi guys, I've wrote some code that will check two dates - they are split into two day inputs (#enddate-1-dd, #date-1-dd), two month inputs (#enddate-1-mm, #date-1-mm) and two year inputs (#enddate-1, #date-1) I wanted to check first of all that they're all actually numbers, but then I wanted to check each one to make sure it's in a dat...

Multi-Query SQL Condensed to One Result

There's information that my web-app needs from my database that I can only generate for the entire database with many queries populating a brand new table. Can anyone suggest to me a single query that returns the results the exact same as this populated table? First, here are the two tables that have the information. CREATE OR REPLACE ...

Query Optimization. Why did TOAD do this?

SQL Server 2008. I have this very large query which has a high cost associated with it. TOAD has Query Tuning functionality in it and the only change made was the following: Before: LEFT OUTER JOIN (SELECT RIN_EXT.rejected, RIN_EXT.scar, RIN.fcreceiver, ...

Blackberry setting a clipping region/area

In J2ME we have the clipRect() and setClip() to clip a region in the Graphics area. What is the equivalent apis available in BlackBerry and how do we use it? ...

Tree depth in SQL

Assuming that there's a table called tree_node, that has the primary key called id and has a nullable column called parent_id and the table embeds a tree structure (or a forest), how can one compute the depth of a node in the tree/forest in an efficient way in SQL? ...

Speed of R Programming Language

R is a scripting language, but is it fast? It seems like a lot of the packages used by R are actually compiled from C. Does anyone have an example of how using languages like C or Java instead of R caused a noticeable increase in speed? Is there a fair benchmark somewhere? Is there a C (or any other compiled) library that has many of...

Speeding up row counting in MySQL

Suppose, for illustrative purposes, you are running a library using a simple MySQL "books" table with three columns: (id, title, status) id is the primary key title is the title of the book status could be an enum describing the book's current state (e.g. AVAILABLE, CHECKEDOUT, PROCESSING, MISSING) A simple query to report how many...

What are your most common sql optimizations?

I wonder what are your most common sql optimization that you used. ...

C++ and QT4.5 - is passing a const int& overkill? Does pass by reference helps in signals/slots?

Two questions rolled into one here... I have a number of functions which are called multiple times per frame for a real-time video processing application. Taking advice about const and pass by reference, the functions have a signature somewhat like this void processSomething(const int& value); As I keep typing the few extra character...

NHibernate + SqlCE - Forever Lazy?

I'm working on a Winforms app with NHibernate as my ORM layer. Everything is going well, but it doesn't seem that NHibernate is respecting my instructions to not use lazy loading. Problem 1: The app is a task list type of thing, and tasks can have child tasks. I'm representing these in a TreeView, so I need to first add nodes for top-l...

Is a relational database well suited for vector calculations?

The basic table schema looks something like this (I'm using MySQL BTW): integer unsigned vector-id integer unsigned fk-attribute-id float attribute-value primary key (vector-id,fk-attribute-id) The vector is represented as multiple records in the table with the same vector-id I need to build a separate table with the dot product (al...

C# 2k8 reduce memory usage (simple app takes 10 MB)

Hello I have a simple C# 2008 application which displays a png-picture and handles some simple MouseEvents. Although it's nothing complex, it uses at least 9.5-10 MB of memory (as shown in task-manager) I've already disabled any type of error logging as well as I removed debug and trace symbols. "Optimize Code" is activated. Is ther...

Branching optimization

What is the best implementation, from a performance point of view, of branched function calls? In the naive case we have a rather large switch statement that interprets bytecode and executes a function call depending on code. In the normal case we have computed gotos and labels that do the same thing. What is the absolute best way t...

How can I further optimize javascript table row creation/insertion?

I'm using jQuery. I have website feature that does an ajax search and returns a JSON result. The ajax callback then populates the rows of a table with the results. Generally, there are 100 rows per search that get inserted. Each row has a fair amount of data. The code looks something like this (very much abbreviated): function sear...

Why is this code being generated by avr-gcc and how does it work?

This is a snippet of disassembled avr code from a C project I'm working on. I noticed this curious code being generated and I can't understand how it works. I'm assuming it's some sort of ridiculous optimization... Can anyone explain? 92: ticks++; +0000009F: 91900104 LDS R25,0x0104 Load direct from data space +0...

Deserializing data from file. Performance issue

I read a table with more than 1 million records from a database. It takes 3 minutes until I have a populated object in memory. I wanted to optimize this process, and serialized this object to a file using binary BinaryFormatter. It created a file with 1/2 GB size. After I deserialized this file back to memory object. This took 11 minutes...

Fastest way to compare strings (literal and numerical)

I have a performance problem related to string comparison (in Java). I'm working on a project that needs to sort a huge list (a TableViewer in Eclipse). Anyway I've pinpointed the bottleneck down to the call to compareTo() for the string to be compared. Is there any way to optimize the performance of a string compare? I've searched and...