optimization

What are the best techniques for making my LAMP sites download faster?

Hi Everyone I have a few sites I built for my work, nothing major, mainly just little tools which people can access and use when they're out of the office. I'm not very experienced as a developer but I like to tinker quite a lot and I was wondering if anyone had any clever little tweaks I could do to my sites to make them download faste...

Why are images and javascript files included in DNN no longer cached on the client after I replace them?

I installed DotNetNuke version 4.9.2 and I'm watching the primed cache states using Firebug and YSLOW... All the images and javascript are cached on the client, unless I replace them... So If I upload a new LOGO image, it is no longer cached. The existing ones are cached. If i replace an existing .js file (I ran one through the minifi...

Best Data Structure for The Following Constraints?

Here are some constraints for a data structure I need. It seems like none of the common data structures (I will mention the ones I've thought of below) fit these all that well. Can anyone suggest one that I maybe haven't thought of? I need to be able to perform lookups by unsigned integer keys. The items to be stored are user-defined...

Will the C/C++ compiler optimize this if statement?

I have code like this, and I find it a bit hard to read: // code1 if( (expensiveOperation1() && otherOperation() && foo()) || (expensiveOperation2() && bar() && baz()) { // do something } I just changed it to the following, to make it more readable: // code2 const bool expr1 = expensiveOperation1() && otherOperation() && foo(...

Joining on varchar(50) foreign key slows query

I have this query which is pretty long, but adding a where clause to it, or joining on a string makes it take an extra 2 seconds to run. I can't figure out why. Here's the query in full: ALTER PROCEDURE [dbo].[RespondersByPracticeID] @practiceID int = null, @activeOnly bit = 1 AS BEGIN SET NOCOUNT ON; select isnul...

What is anulled branch different from regular branch instructions?

For SPARC Assembly particularly, how are anulled branches different from regular branches? I always thought that anulling branch instructions is required when I need to fill the nop delay slot for branch instructions. However, I don't think I'm correct on this part, because you can fill the nop without anulling the branch. ...

How can one compute the optimal parameters to a start-step-stop coding scheme?

A start-step-stop code is a data compression technique that is used to compress number that are relatively small. The code works as follows: It has three parameters, start, step and stop. Start determines the amount of bits used to compute the first few numbers. Step determines how many bits to add to the encoding when we run out and s...

const vs enum in D

Check out this quote from here, towards the bottom of the page. (I believe the quoted comment about consts apply to invariants as well) Enumerations differ from consts in that they do not consume any space in the final outputted object/library/executable, whereas consts do. So apparently value1 will bloat the executable, while va...

Finding the most optimal 2x2 matches between heterogeneous collections

I've got a problem: I have a class A and a class B, whose instance objects can be inspected programatically to be similar or different from one another in varying amounts. For instance they may match perfectly, or be quite different (even though the classes are different, they can still represent the same information and be scored iden...

Whats the best way to manage QUERY_STRING in php?

One of my sites has some very complicated sorting functions, on top of a pagination, and the various variables add up to a pretty complex URL, which is a huge pain to manage. Is there a way to manage the QUERY_STRING efficiently? By this I mean... if the url is index.php?catid=3&sort=date&year=2009&page=2 and I wish to have the user ju...

MySQL Type for Storing a Year: Smallint or Varchar or Date?

I will be storing a year in a MySQL table: Is it better to store this as a smallint or varchar? I figure that since it's not a full date, that the date format shouldn't be an answer but I'll include that as well. Smallint? varchar(4)? date? something else? Examples: 2008 1992 2053 ...

What to do with Java BigDecimal performance?

I write currency trading applications for living, so I have to work with monetary values (it's a shame that Java still doesn't have decimal float type and has nothing to support arbitrary-precision monetary calculations). "Use BigDecimal!" — you might say. I do. But now I have some code where performance is an issue, and BigDecimal is mo...

Fully optimized memcpy/memmove for Core 2 or Core i7 architecture?

The theoretical maximum of memory bandwidth for a Core 2 processor with DDR3 dual channel memory is impressive: According to the Wikipedia article on the architecture, 10+ or 20+ gigabytes per second. However, stock memcpy() calls do not attain this. (3 GB/s is the highest I've seen on such systems.) Likely, this is due to the OS vend...

Software optimization for virtual machines

When you know that your software (not a driver, not part of the os, just an application) will run mostly in a virtualized environment are there strategies to optimize your code and/or compiler settings? Or any guides for what you should and shouldn't do? This is not about a 0.0x% performance gain but maybe, just maybe there are simple t...

Can I check if the C# compiler inlined a method call?

I'm writing an XNA game where I do per-pixel collision checks. The loop which checks this does so by shifting an int and bitwise ORing and is generally difficult to read and understand. I would like to add private methods such as private bool IsTransparent(int pixelColorValue) to make the loop more readable, but I don't want the overhea...

SQL Optimization

Is there a performance difference between these two queries. Apparently WHERE should be reserved for querying values on the table to be SQL 92 compliant, is there a performance reason? SELECT Foo.FooId ( SELECT Bar.BarId FROM Bar WHERE Bar.FooId = Foo.FooId FOR XML PATH('Bar'), TYPE ) As 'Bar' ...

What do you have in your log4net config? Hacks, optimizations, observations?

This is my log4net config file <?xml version="1.0" encoding="utf-8" ?> <log4net debug="true"> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" > <filter type="log4net.Filter.LevelRangeFilter"> <acceptOnMatch value="true" /> <levelMin value="DEBUG" /> <levelMax value="FATAL" /> </f...

What is PAGEIOLATCH_SH wait type in SQL Server?

I have a query that is taking a long time in the middle of a transaction. When I get the wait_type of the process it is PAGEIOLATCH_SH. What does this wait type mean and how can this be resolved? ...

Efficient MySQL table structure for rating system

This post is a follow-up of this answered question: Best method for storing a list of user IDs. I took cletus and Mehrdad Afshari's epic advice of using a normalized database approach. Are the following tables properly set up for proper optimization? I'm kind of new to MySQL efficiency, so I want to make sure this is effective. Also,...

Where do I find a standard Trie based map implementation in Java?

I have a Java program that stores a lot of mappings from Strings to various objects. Right now, my options are either to rely on hashing (via HashMap) or on binary searches (via TreeMap). I am wondering if there is an efficient and standard trie-based map implementation in a popular and quality collections library? I've written my own...