optimization

YSlow recommendations. How necessary are they?

So I've just downloaded yslow for firebug and have taken a look at the results for a site I am building. I'm seeing recommendations, for example, to use ETags, cookie-free domain for my static components, and add expires headers. I'm thinking, well I could go off and fix these but there's more likely a bunch of other optimizations I co...

C++ : Will compiler optimize &Variable; away?

In C++ a statement like this is valid: &Variable; IMO it doesn't make any sense, so my question is, if you do this, will it affect the compiled result in any way, or will the compiler optimize it away? Thanks! ...

Optimizing my mysql query to use index for sorting

I have a composite index based on 3 columns, two of which are constrained in my query and the 3rd is in order by clause yet mysql doesn't use index for sorting. explain select * from videos where public_private='public' and approved='yes' order by number_of_views desc; +----+-------------+--------+------+------------------------------...

Why does processing multiple individual targets take longer when Nant is directed to process them from a single target?

I have a nant build script that specifies the compilation of various Visual Studio solution files. <target name="compile.solution1" description="Compiles solution 1"> <msbuild project="${src.dir}\Solution1.sln" verbosity="${build.verbosity}"> <property name="Configuration" value="${build.config}" /> <property name="OutputPath" val...

LINQ Optimizations for IOrderedEnumerable

Is anyone aware of whether there are there any built-in capabilities in the LINQ library (or a publicly available utility library) for optimized operations on IOrderedEnumerable<T>, as opposed to IEnumerable<T>? For example, in theory, the Contains<T>() extension could potentially be optimized to use binary search when it is applied to ...

Product mode with a Debug DLL

I know that a class library compiled in 'Release' mode will run faster and more efficiently than one compiled in 'Debug' mode, but does anyone know to what extent? EDIT: This is for a .net dll. ...

Java BigInteger, cut off last digit

Fairly easy, if the BigInteger number is 543 I want it to cut off the last digit so that it is 54. Two easy ways to do this can be : Use strings, get substring and create new biginteger with the new value. Use BigIntegers divide method with number 10. ( 543 / 10 = 54.3 => 54 ) The thing is I will be performing this a lot of times wi...

Force compiler to not optimize side-effect-less statements

I was reading some old game programming books and as some of you might know, back in that day it was usually faster to do bit hacks than do things the standard way. (Converting float to int, mask sign bit, convert back for absolute value, instead of just calling fabs(), for example) Nowadays is almost always better to just use the stand...

MySQL - Need help counting id's that correspond to certain in other tables

Hi, I have on table named players, then other tables named tries, conversions, penalties, dropgoals. I need to get the player_id from players, then count the following: number of tries for player_id in tries number of conversions for player_id in conversions number of penalties for player_id in penalties number of dropgoals for player...

Javascript + Firebug : "cannot access optimized closure" What does it mean?

I just got the following error in a piece of javascript (in Firefox 3.5, with Firebug running) cannot access optimized closure I know, superficially, what caused the error. I had a line options.length() instead of options.length Fixing this bug, made the message go away. But I'm curious. What does this mean? What is an optimiz...

How to store and call a compiled function in C / C++?

For very low level optimization purposes it would be useful to me if I could store a compiled function inside a variable directly, not a pointer to a function. That is, if I have a function foo, I want to make a char buffer large enough to hold the machine instructions generated for foo, and then be able to in effect call foo by somehow ...

line drawing routine

How to optimize this line drawing routine ? Will memcpy work faster ? void ScreenDriver::HorizontalLine(int wXStart, int wXEnd, int wYPos, COLORVAL Color, int wWidth) { int iLen = wXEnd - wXStart + 1; if (iLen <= 0) { return; } while(wWidth-- > 0) { COLORVAL *Put = mpScanPointers[wYPos] + wXS...

Another way to select count(distinct userID) from a table?

Is there a faster way to select the distinct count of users from a table? Perhaps using row_number, partitioning, or cross apply? I just can't think of it right now. Example: Table UsageLog UserId Date StoreNumber Alice 200901 342 Alice 200902 333 Alice 200902 112 Bob 200901 112 Bob 200...

JavaScript Performance Evaluation

background: I've searched around for a reference, or possibly a tool, that helps you theoretically evaluate the efficiency (resource cost) of your JavaScript. This search has turned up a lot of excellent debugging software, but I can't really find something that helps me optimize the code, by utilizing less resource-intensive methods. ...

Limitations of using binary_checksum() to represent a URL or similar string?

I have a log that is really huge. (millions of rows) LogTable ------- ID DATE BASEURL QUERYSTRING USER REFERRER USERAGENT SERVER I want to slim this table down by normalizing the data. (slim the size) I know! I know! A log should be a super-fast insert. On the other hand, the log table is so huge, the maintenance plan i...

Storing Large Lookup Tables

I am developing an app that utilizes very large lookup tables to speed up mathematical computations. The largest of these tables is an int[] that has ~10 million entries. Not all of the lookup tables are int[]. For example, one is a Dictionary with ~200,000 entries. Currently, I generate each lookup table once (which takes several minute...

How to Make PHP Faster: Does String Creation Have No Cost?

In this question a code bit is presented and the questioner wants to make it faster by eliminating the use of variables. Seems to me he's looking in the wrong place, but far be it from me to know. Here's the code while ($item = current($data)) { echo '<ATTR>',$item, '</ATTR>', "\n"; next($data); } Seems to me that the recreat...

Finding the nearest used index before a specified index in an array (Fast)

This question is related to http://stackoverflow.com/questions/1053242/array-of-pairs-of-3-bit-elements This array has 52 pairs (about 40 bytes), and I want to find the first pair before the specified one that has it's values different from 0 (used pair). The obvious solution would be to check each pair < than this one (scan from right t...

understanding mysql explain

So, I've never understood the explain of MySQL. I understand the gross concepts that you should have at least one entry in the possible_keys column for it to use an index, and that simple queries are better. But what is the difference between ref and eq_ref? What is the best way to be optimizing queries. For example, this is my latest ...

Merged CSS Fails In Firefox

In order to dramatically reduce the number of HTTP requests on my ASP.NET MVC website, I am programmatically merging the files. Essentially, I have an MVC URL http://localhost/Optimisation/JavaScript/ that calls my controller. The controller reads the javascript files in a certain order, merges them into a single output and renders it o...