optimization

Purging SQL Tables from large DB?

The site I am working on as a student will be redesigned and released in the near future and I have been assigned the task of manually searching through every table in the DB the site uses to find tables we can consider for deletion. I'm doing the search through every HTML files source code in dreamweaver but I was hoping there is an aut...

Help in optimizing a query for a Postgresql database

I'm trying to find some suggestions in optimizing a query that I'm using to fetch a large group of data. The original code that I'm working on looped through a large set of users, and calculated a date range for each one of them. It would then take that date range and query how many questions they answered and how many they got correct...

Can I compile my PHP script to a faster executing format?

I have a PHP script that acts as a JSON API to my backend database. Meaning, you send it an HTTP request like: http://example.com/json/?a=1&b=2&c=3... it will return a json object with the result set from my database. PHP works great for this because it's literally about 10 lines of code. But I also know that PHP is slow and...

Faster String GetHashCode (e.g. using Multicore or GPU)

According to http://www.codeguru.com/forum/showthread.php?t=463663 , C#'s getHashCode function in 3.5 is implemented as: public override unsafe int GetHashCode() { fixed (char* str = ((char*) this)) { char* chPtr = str; int num = 0x15051505; int num2 = num; int* numPtr = (int*) chPtr; for ...

Java optimization, gain from hashMap?

I've been give some lovely Java code that has a lot of things like this (in a loop that executes about 1.5 million times). code = getCode(); for (int intCount = 1; intCount < vA.size() + 1; intCount++) { oA = (A)vA.elementAt(intCount - 1); if (oA.code.trim().equals(code)) currentName= oA.name; } Would I see significant in...

Technique for determining if an integer sequence can be generated without branches?

If you're optimizing for an architecture on which branching is expensive (say the PS3's cell processor), it can be important to be able to determine whether or not you can express a given algorithm without using branches or at least using fewer branches. One pattern that I see a lot in unoptimized code is a bunch of if's used to tweak a...

Optimizing a high-traffic function in XNA

I have a function that's called hundreds of thousands of times per update, and i need to optimize it. Now, i generally follow the "don't optimize too soon" rule but this is a critical function that virtually all of my code's time is spent in, so anything you can suggest would help. I'm also not that familiar with any sort of tips and tri...

Best books on how to optimize and profile Python code

What are the best books on how to optimize and profile Python code? ...

Best books on how to optimize and profile Java code

What are Best books on how to optimize and profile Java code? ...

Optimising Mysql Databases

I am planning to research how to improve my Databases (in speed , quality,queries ,transaction , indexes ) and i would like to know what are the best books for that. I would like the links to the books on where I could download them/buy. I wanna find out how to improve the speed on my database engine , what mistakes should I avoid or wh...

Array Performance/Optimization

I am reading a CSV file and I would like to cache the results in an array. This is my getter/setter: private RedirectionRule[] RedirectionRules { get { if (_redirectionRules == null) { return new RedirectionRule[MAXLENGTH]; } return _redirectionRules; } set { _re...

How does JavaScript memory work in browsers?

When building advanced JS-interfaces and games I've found that I have to dig deeper in to how browsers handles memory for JS. My experience with memory and JavaScript is that the memory gets glogged (and makes animations and calculation slow/lagging ) when: There is alot of JS-generated content on the page There is alot of graphics (i...

Jetty 6 - QueuedThreadPool versus ThreadPool

Hi all, I am using Jetty 6 and was wondering when the QueuedThreadPool should be used over the ThreadPool? By default, Jetty 6 comes configured with the QueuedThreadPool. My server has Java 6 installed so I was thinking that I should use the ThreadPool: <New class="org.mortbay.thread.QueuedThreadPool"> <Set name="minThreads">10...

Tools for optimizing / minimizing swf filesize

Hi guys, I'm working on a big flash site with lots of component swfs and a ton of heavy multimedia (video, audio, image) content. File sizes are quickly getting ridiculous and I'm looking around for solutions--I want to minimize user wait time as much as possible (and my art direction is such that minimizing multimedia isn't an option)...

Stream with a lot of UPDATEs and Postgres

I'm quite a newbie with PostgreSQL optimization and chosing whatever's appropriate job for it and whatever's not. So, I want to know whenever I'm trying to use PostgreSQL for inappropriate job, or it is suitable for it and I should set everything up properly. Anyway, I have a need for a database with a lot of data that changes frequentl...

Find buy/sell prices in array of stock values to maximize positive difference

Got this question in an interview today, and its optimized solution stopped me cold (which blows, because I really wanted to work for this company...) Given a single array of real values, each of which represents the stock value of a company after an arbitrary period of time, find the best buy price and its corresponding best sell price...

Performance optimisation - Postgres

I have been tasked with improving the performance of a slow running process which updates some data in a PostGres 8.3 database (running on Solaris, updates are driven by Perl 5.8 scripts through SOAP). About 50% of the time consumed I have very little control over so tuning my 50% is quite important. There are usually about 4,500,000 r...

Any experience combining JS / CSS in MVC?

I'm planning to implement a solution for combining multiple js/css files into single files in my MVC project, but currently I doubt between the following two possibilities: Telerik Extensions for ASP.NET MVC (www.telerik.com/products/aspnet-mvc.aspx) Supports combining multiple files into one request Supports groups of web assets Sup...

Can likely/unlikely macros be used in user-space code?

I came across these 2 macros in Linux kernel code. I know they are instructions to compiler (gcc) for optimizations in case of branching. My question is, can we use these macros in user space code? Will it give any optimization? Any example will be very helpful. ...

Producing the fastest possible executable

I have a very large program which I have been compiling under visual studio (v6 then migrated to 2008). I need the executable to run as fast as possible. The program spends most of its time processing integers of various sizes and does very little IO. Obviously I will select maximum optimization, but it seems that there are a variety of...