optimization

Hard file on the server or binary for sound and image files in SQL with ASP.Net application

I am building an ASP.Net C# web application that will be using lots of sound files and image files. Considering performance, would it be best to store all files in SQL as image data type and retrieve from the database or store/archive the hard file on the server and store the path in sql? Im curious about the pros and cons - other than t...

A better way to replace many strings - obfuscation in C#

I'm trying to obfuscate a large amount of data. I've created a list of words (tokens) which I want to replace and I am replacing the words one by one using the StringBuilder class, like so: var sb = new StringBuilder(one_MB_string); foreach(var token in tokens) { sb.Replace(token, "new string"); } It's pretty slow! Are there an...

LINQ Optimization Question

So I've been using LINQ for a while, and I have a question. I have a collection of objects. They fall into two categories based on their property values. I need to set a different property one way for one group, and one way for the other: foreach(MyItem currentItem in myItemCollection) { if (currentItem.myProp == "CATEGORY_ONE"...

Have you ever used ngen.exe?

Has anybody here ever used ngen? Where? why? Was there any performance improvement? when and where does it make sense to use it? ...

Tips for optimising Database and POST request performance

I am developing an application which involves multiple user interactivity in real time. It basically involves lots of AJAX POST/GET requests from each user to the server - which in turn translates to database reads and writes. The real time result returned from the server is used to update the client side front end. I know optimisation ...

GCC function attributes vs caching

I have one costly function that gets called many times and there is a very limited set of possible values for the parameter. Function return code depends only on arguments so the obvious way to speed things up is to keep a static cache within the function for possible arguments and corresponding return codes, so for every combination of ...

Oracle 10g - optimize WHERE IS NOT NULL

Hi - We have Oracle 10g and we need to query 1 table (no joins) and filter out rows where 1 of the columns is null. When we do this - WHERE OurColumn IS NOT NULL - we get a full table scan on a very large table - BAD BAD BAD. The column has an index on it but it gets ignored in this instance. Are there any solutions to this? Thanks ...

How to detect 'strict aliasing' at compile time?

'Strict aliasing' optimization needs special care from the source code, s.a. using a union instead of pointer casts. Is there a way to detect using preprocessor directives (#if/else) whether the compiler is trying to do such optimizations? I would like to maintain the old and non-strict-aliasing-prepared code path for processors and com...

MySQL not using indexes ("Using filesort") when using ORDER BY ...

I'm hitting some quite major performances issues due to the use of "ORDER BY"-statements in my SQL-code. Everything is fine as long as I'm not using ORDER BY-statements in the SQL. However, once I introduce ORDER BY:s in the SQL code everything slows down dramatically due to the lack of correct indexing. One would assume that fixing th...

What techniques do JavaScript compression libraries use to mimize file size?

Please note that this question is intended to be a bit more on the theory side of the subject, but besides stripping whitespace what other techniques are used for JavaScript Compression? ...

Why do my ASP.NET pages render slowly when placed on the server?

I have a simple aspx page with a GridView control. I'm loading the GridView with search results after the click of a button. Everything works, but the HTML rendering on the browser is very slow in IE with a result set > 2000 (works fine in other browsers.) I realize it's slow due to the record count, but is there a way I can make it fas...

c++ profiling/optimization: How to get better profiling granularity in an optimized function

I am using google's perftools (http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html) for CPU profiling---it's a wonderful tool that has helped me perform a great deal of CPU-time improvements on my application. Unfortunately, I have gotten to the point that the code is still a bit slow, and when compiled using g++'s -O3 ...

Regarding HotSpot optimization in Java

I've done some HotSpot optimization in Java. However, I'm now concerned about space in relation to loading classes (ie. only need one method in a class, don't want to load others). How would I go about doing so? ...

Read a line of input faster than fgets?

I'm writing a program where performance is quite important, but not critical. Currently I am reading in text from a FILE* line by line and I use fgets to obtain each line. After using some performance tools, I've found that 20% to 30% of the time my application is running, it is inside fgets. Are there faster ways to get a line of text?...

Does rearranging a conditional evaluation speed up a loop?

Bit of a weird one: I was told a while ago by a friend that rearranging this example for loop from : for(int i = 0; i < constant; ++i) { // code... } to: for(int i = 0; constant > i; ++i) { // code... } would slightly increase performance in C++. I don't see how comparing a constant value to a variable is faster than vice-...

Looking for a clean, efficient way to match a set of data against known patterns.

Using php5.2 and MySQL 4.1.22 I've come across something that, at first, appeared simple but has since evaded me in regards to a simple, clean solution. We have pre-defined "packages" of product. Package 1 may have products A, B and C in it. Package 2 may have A, C, D and G in it, etc. The packages range in size from 3 to 5 products. ...

Boost Deserialization Optimizations?

I'm deserializing a fair amount of data through Boost.Serialization (one for each frame). However, when I output how long the deserialization takes, it varies wildly. It is not unusably slow at the moment, but it would be nice to make it faster. The data represents the same classes, arrays, maps and vectors but merely with different valu...

Most efficient way to generate reports in MySQL on massive datasets

Hi there, I need to build a reporting interface to an application I'm working on which requires administrators to visualise huge quantities of collected data over time. Think something similar to Google Analytics etc. Most of the data that needs to be visualised sits in a basic table which contains a datetime, 'action' varchar and oth...

Is Perl or C faster at parsing?

I have a few very large log files, and I need to parse them. Ease of implementation obviously points me to Perl and regex combo (in which I am a still novice). But what about speed? Will it be faster to implement it in C? Each log file is in the order of 2 GB. ...

SQL Server indexes - ascending or descending, what difference does it make?

When you create an index on a column or number of columns in MS SQL Server (I'm using version 2005), you can specify that the index on each column be either ascending or descending. I'm having a hard time understanding why this choice is even here. Using binary sort techniques, wouldn't a lookup be just as fast either way? What differenc...