optimization

How to organize minification and packaging of css and js files to speed up website?

I am doing speed optimization for my website application. And I found some practises to do that. For example Best Practices for Speeding Up Your Web Site from Yahoo. Among them are: Minify JavaScript and CSS. Minimize number of HTTP Requests by combining several files (css, js) into one. My question is what infrastructure, tools and ...

How can I make Java3D start faster?

My application takes several seconds to show the first window with a Canvas3D in it. I've profiled it and found that the bottleneck is in SimpleUniverse.getPreferredConfiguration(); the first call takes three or four seconds, and it must be called before the scene can be rendered. I'm using the Direct3D renderer (-Dj3d.rend=d3d), becaus...

What are the benefits of maintaining a “clean” list of assembly references?

Just like Carl's question over here I would like to ask you (because I couldn't find it out on my own :( ) if there is any benefit by removing an assembly reference that is not statically nor dynamically (via reflection for example) used. ...

SQL query : inner joins optimization between big tables

Hello, I have the 3 following tables in a MySQL 4.x DB : hosts: (300.000 records) id (UNSIGNED INT) PRIMARY KEY name (VARCHAR 100) paths: (6.000.000 records) id (UNSIGNED INT) PRIMARY KEY name (VARCHAR 100) urls: (7.000.000 records) host (UNSIGNED INT) PRIMARY KEY <--- links to hosts.id path (UNSIGNED INT) PRIMARY KEY <--- links ...

What opcode dispatch strategies are used in efficient interpreters?

What techniques promote efficient opcode dispatch to make a fast interpreter? Are there some techniques that only work well on modern hardware and others that don't work well anymore due to hardware advances? What trade offs must be made between ease of implementation, speed, and portability? I'm pleased that Python's C implementation i...

"SELECT COUNT(*)" is slow, even with where clause

I'm trying to figure out how to optimize a very slow query in MySQL (I didn't design this): SELECT COUNT(*) FROM change_event me WHERE change_event_id > '1212281603783391'; +----------+ | COUNT(*) | +----------+ | 3224022 | +----------+ 1 row in set (1 min 0.16 sec) Comparing that to a full count: select count(*) from change_event; ...

SQL Performance Question

Hi, I have a question regarding the performance of SQL. I will illustrate my problem with pseudocode. I am wondering which will preform better and by how much? Say for 10 items, on each page load. In .NET. Is is a lot faster? a little faster? A difference not noticable on SQL? foreach(item in mylist) { CallSQLStoredProc(item.id); }...

Is it more efficient to branch or multiply?

I am trying to optimize a small, highly used function which uses the high bits in an unsigned short int to indicate the values of an array to sum together. At first I was using the obvious approach shown below. Please note that loop unrolling is not explicitly shown as it should be done by the compiler. int total = 0; for(unsigned short...

Microsoft SQL Server 2005/2008: XML vs text/varchar data type

Does it have any sense (except of server side validation XML/schema/dtd) to store XML in XML type instead of text/varchar/ntext? I'm not planning to do any XML manipulation on database side. Purpose of my investigation is to decrease database size. Can a using an XML data type for untyped XML for the purpose? Which other pros and cons i...

Planning for efficiency early vs Premature optimization

I seem to notice two schools of thought emerging in regards to optimization: Premature optimization is the root of all evil. You should only optimize when you've written the most readable and simplest thing possible. If after profiling you determine that the software is too slow, you should optimize. Optimizations should be done earl...

What are the generic ways to make Reporting Services faster.

While I understand this question is fairly vague since I'm not giving you all as much detail as I'd like to, I'm hoping for some general improvements that can be made to my generation code or the reports themselves to speed them up. I've asked for more hardware, but have been denied. public Stream GenerateReport(string reportName, strin...

Is my index page too large?

I'm developing a site right now that I've been working on for more than a year. Today, I am about one week from launching so I started going over things that I've not gone over during the last year - including loading-times. I've not noticed any loading-issues, but I still wanted to look. The following represents my index page: Docume...

How do I run nGen at the end of the installation (MSI)?

I would like to execute nGen at the end of my installation simply to improve the perceived performance of the first startup of my application. How could I do that? Is there are some best practices? Can I be sure that nGen is always installed with .NET Framework? Thanks! ...

How can I strip Python logging calls without commenting them out?

Today I was thinking about a Python project I wrote about a year back where I used logging pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (hotshot indicated it was one of my biggest bottlenecks). I wonder now if there's some canonical way to...

Any way to analyze the size of a SWF built in Flex?

I have a Flex application that seems larger than it should be. There is a lot of code in it, but not a lot of assets and it just seems large, but I'm not sure how to go about figuring out where the space is going. I know about the –link-report option, but it only gives the sizes of externally linked library classes. I'm very interested ...

Fast transcendent / trigonometric functions for Java

Since the trigonometric functions in java.lang.Math are quite slow: is there a library that does a quick and good approximation? It seems possible to do a calculation several times faster without losing much precision. (On my machine a multiplication takes 1.5ns, and java.lang.Math.sin 46ns to 116ns). Unfortunately there is not yet a way...

SQL "ON" Clause Optimization

Which query would run faster? SELECT * FROM topic_info LEFT JOIN topic_data ON topic_info.id = topic_data.id WHERE id = ? or SELECT * FROM topic_info LEFT JOIN topic_data ON topic_data.id = topic_info.id WHERE id = ? The difference is the order of expressions on the "ON" clause: the first query is checking topic_info.id aga...

Will Garbage Collected C be Faster Than C++?

I had been wondering for quite some time on how to manager memory in my next project. Which is writing a DSL in C/C++. It can be done in any of the three ways. Reference counted C or C++. Garbage collected C. In C++, copying class and structures from stack to stack and managing strings separately with some kind of GC. The community ...

How do I unroll (compile) an interpreter loop?

I heard that some languages go from interpreted to compiled by "unrolling the interpreter loop". Let's say I have the following pseudo-c-code interpreter for an ast tree. int interpret(node) { switch(node) { case PLUS: return interpret(child(0))+interpret(child(1)); case MINUS: return inter...

Optimising Iterator Definitions

Hi all, This is a (hopefully) really simple question - I have been told recently that using C++ style initialisation is better than traditional (and more common) assignment. So this code: std::SomeSTLContainer::const_iterator it = container.begin(); std::SomeSTLContainer::const_iterator itEnd = container.end(); would be 'slower' or ...