optimization

Generate uint64_t hash key with several uint32_t integers

Hi everyone, I'm facing the same problem than Eduardo (http://stackoverflow.com/questions/539311/generate-a-hash-sum-for-several-integers) but mine is a little bit different as said in the title. I have four 32bits integers and I need to generate a 64bits unique key. What I have done for now is to generate a string concatenation of the ...

Generate all subset sums within a range faster than O((k+N) * 2^(N/2))?

Is there a way to generate all of the subset sums s1, s2, ..., sk that fall in a range [A,B] faster than O((k+N)*2N/2), where k is the number of sums there are in [A,B]? Note that k is only known after we have enumerated all subset sums within [A,B]. I'm currently using a modified Horowitz-Sahni algorithm. For example, I first call it t...

SQL Server Optimization - how to store repeat data

My project has an "Activity Monitor" that monitors the activity of a user. Currently the way it works is, I have a method called LogActivity and it submits the data to the database. I call this method when a user has a new session start, when a user registers, when they update their profile, etc. Basically there are 3 or 4 different a...

Drupal's JS and CSS optimization error

I started getting errors after I turned on Drupal's performance improvements which pack all the CSS and JS files into single files. The error looks like this: The selected file /tmp/fileO4fjBF could not be uploaded, because the destination js/js_8a69e612be02242c2866a4a19223bd12.js is not properly configured. I'm not sure ho...

AWT text measuring implementations

The Java 6 (J2SE) implementation of AttributedString, TextLayout, and LineBreakMeasurer classes use anti-aliasing properties and fractional math for metrics calculations. This causes a severe performance penalty. What suggestions (for Cent OS Linux) do you have to increase performance? Such as: A faster JVM (JDK 1.7, Oracle's JRockit,...

please help me with optimizing query with these MySQL tables

Hi all! I need some help optimizing queries on 2 tables. One will contain about a million and the other will contain about 10 million of rows. here is the table structure -- Table Structure Sample Browse and Search Queries These queries takes a very long time, about 15-20 secs, in some cases over a minute So, please have a look an...

How to choose server for production release of my Django application?

My company is at the very end of development process of some (awesome:)) web application. This app will be available as a online service for (hopefully) some significant number of users. This is our biggest django release so far and as we are preparing to release some question about deployment have to be answered. Q1: how to determine r...

MySQL: Does a 'unique' column field imply an index, and if so, why?

Hi all, Although I understand that it is very convinient to have an index on a unique column - to easily and efficiently check for value collision, I think it should be up to the programmer to specify whether a unique field column is to have an index or not, with regards to size- vs speed- optimization. As far as I understand MySQL aut...

CMS Settings, .INI file or MySQL?

I'm looking for the best solution to store the ettings for a website, like the limit of posts for users, limit of users online, ranks, min. number of posts to be able to do something. Like here, if you're new you can't thumbs up/down a post, or whatever, so how would you store all of these? I thought of creating a table with constants in...

SIMD/SSE newbie: simple image filtering

I'm very new to SIMD/SSE and I'm trying to do some simple image filtering (blurring). The code below filters each pixel of a 8-bit gray bitmap with a simple [1 2 1] weighting in horizontal direction. I'm creating sums of 16 pixels at a time. What seems very bad about this code, at least to me, is that there is a lot of insert/extract in...

Integers caching in Java

Possible Duplicate: Weird Java Boxing Hi guys, Recently I saw a presentation where was the following sample of Java code: Integer a = 1000, b = 1000; System.out.println(a == b); // false Integer c = 100, d = 100; System.out.println(c == d); // true Now I'm a little confused. I understand why in first case the result ...

Sealed keyword in leaf node classes

While I understand that sealed can be used for security reasons, a few people use the sealed keyword on leaf nodes as an optimization technique. How does this help optimization? Why isn't the compiler smart enough to figure this out itself? ...

large insert in two tables. First table will feed second table with its generated Id

Hi all, One question about how to t-sql program the following query: Table 1 I insert 400.000 mobilephonenumbers in a table with two columns. The number to insert and identity id. Table 2 The second table is called SendList. It is a list with 3columns, a identity id, a List id, and a phonenumberid. Table 3 Is called ListInfo and co...

Which is faster — sorting or multiplying a small array of elements?

Reading through Cactus Kev's Poker Hand Evaluator, I noticed the following statements: At first, I thought that I could always simply sort the hand first before passing it to the evaluator; but sorting takes time, and I didn't want to waste any CPU cycles sorting hands. I needed a method that didn't care what order the five cards were g...

SQL Queries - Where to find more optimization tidbits like a=b AND b=c slower than a=b AND b=c AND a=c?

I was just wondering where I could find more information on these optimizations? Google searches tend to emphasize prepared queries and such, and not really at the angle of the abstraction the SQL provides. Source: http://www.joelonsoftware.com/articles/LeakyAbstractions.html The SQL language is meant to abstract away the procedur...

Can I Eliminate Extra Unicode String Calls (Delphi)

I'm using Delphi 2009. In my program, I have been working very hard to optimize all my Delphi code for speed and memory use, especially my Unicode string handling. I have the following statement: Result := Result + GetFirstLastName(IndiID, 1); When I debug that line, upon return from the GetFirstLastName function, it traces into ...

Optimizing Oracle Query

Running explain plan on this query I am getting Full table Access. Two tables used are: user_role: 803507 rows cmp_role: 27 rows Query: SELECT r.user_id, r.role_id, r.participant_code, MAX(status_id) FROM user_role r, cmp_role c WHERE r.role_id = c.role_id AND r.participant_code IS NOT NULL AN...

How to run gradient descent algorithm when parameter space is constrained?

I would like to maximize a function with one parameter. So I run gradient descent (or, ascent actually): I start with an initial parameter and keep adding the gradient (times some learning rate factor that gets smaller and smaller), re-evaluate the gradient given the new parameter, and so on until convergence. But there is one proble...

gcc 4.3.3 compiler options enabled by default

I have moved from gcc version 4.0.3 to 4.3.3 and realized that -mfpmath was set to sse by default in gcc 4.3.3. This actually caused errors in my application. In 4.0.3 the -mfpmath was 387. I want to know how I can get all the default options enabled by gcc for a given version. How can I dump set of all options used by gcc while compil...

http headers for faster image loading ?

Hi, I need to load almost 100's of images in a single page on my website. ( product image, lots of them ). Whenever image change for product, url for that image also changes. i.e. for one url corresponding iamge never changes. Now I want to make sure that for a same person browsing through website, the image must not load again. Is ex...