optimization

When Does It Make Sense To Rewrite A Python Module in C?

In a game that I am writing, I use a 2D vector class which I have written to handle the speeds of the objects. This is called a large number of times every frame as there are a lot of objects on the screen, so any increase I can make in its speed will be useful. It is pretty simple, consisting mostly of wrappers to the related math func...

SQLException in JDBC

Hi, I am getting a SQLException when I try to run the query in Informix DB using JDBC. The query is huge in size: select * table_name where tableid in (....) I get an exception because the 'in' part contain more than 5000 values and because of the length. Is there a way to avoid this or should I break it down and run two queries? ...

How to access app.config/web.config for the current Application?

Although in name this question is similar to this and this, it's not. I'm currently developing a library that may require some custom configuration depending on the user's desire. I have created a custom configuration section, and everything works just fine. However, when I was debugging I noticed that the configuration section const...

Sql returning 3 million records and JVM outofmemory Exception

I am connecting oracle db thru java program. The problem is i am getting Outofmemeory exception because the sql is returning 3 million records. I cannot increase the JVM heapsize for some reason. What is the best solution to solve this? Is the only option is to run the sql with LIMIT? ...

Collect all hits for a search in Lucene / Optimization

Summary: I collect the doc ids of all hits for a given search by using a custom Collector (it populates a BitSet with the ids). The searching and getting doc ids are quite fast according to my needs but when it comes to actually fetching the documents from disk, things get very slow. Is there a way to optimize Lucene for faster document ...

Website optimization - css and images

I'm in the process of optimizing a high traffic site. The site I am working on has many widgets - say 20 or so and only 7 are loaded by default. I was thinking of separating my css and image sprites for faster load times for the default widgets. For the rest of the non-default widgets, I was thinking of having a separate css file a...

Database table design optimise for high volume data

If i were to organise data on tourism and hotel for the continent of Australia and south America can you let me know a best way to do it. Like if i organise the tables thus: continents countries states zipcodes cities destinations hotels lnkhotelszipcodes (in case a hotel exists in multiple places) lnkhotelscities It will be search ...

Counting Distinct Values in large dataset (40M rows): SELECT count(*) as count, name FROM names GROUP BY name ORDER BY name;

CREATE TABLE `names` ( `name` varchar(20) ); Assume the "names" table contains all 40 million first names of everyone living in California (for example). SELECT count(*) as count, name FROM names GROUP BY name ORDER BY name; How can I optimize this query? Expected Result: count | name 9999 | joe 9995 | mike 9990 | kate ... 2 | kal...

good image optimizer that can be used?

Hai guys, I want compress my images without changing the quality... Because my web application uses lots of images and when i inspected with firebug i found images size where huge... Are there any good image optimizer? I know there is SmushIt from yahoo... Any other useful image optimizers? ...

How does sql optimization work internally?

My previous question: http://stackoverflow.com/questions/2112567/date-of-max-id-sql-oracle-optimization In my previous question, I was finding different ways of finding the date of the record with the highest id number. Below are several of the offered solutions, and their 'cost' as calculated by explain plan. select date from table ...

C#: params keyword vs. list

What are the pro/cons of using the params keyword vs. a List as input to some c# function? Mainly what are the performance considerations and other trade offs. ...

GCC vs Greenhills on ARM

I'm interested in any comparisons between GCC and Greenhills C compiler with regard to memory footprint of generated code specifically on ARM platforms. Are there any benchmarks or comparisons for these compilers? Has anyone had any experience here that they'd like to share? ...

Database optimization: Hashing all the values

Hi, Typically, the databases are designed as below to allow multiple types for an entity. Entity Name Type Additional info Entity name can be something like account number and type could be like savings,current etc in a bank database for example. Mostly, type will be some kind of string. There could be additional information associat...

How to explain at your boss that code/resources optimization is important?

Ahhhw, every time is so frustrating.. We have a dedicated server in our hosting company, and everytime i have to write down a new app (or an add to an pre-existing app), i use to 'lose' some time to optimize the code for many behaviors (reducing the db query, optimizing the db structure, reducing the bandwith, etc..) depending on what t...

Is good multithreaded design premature optimization?

While i like the intellectual challenge coming from the design of multicore systems i realize that most of them were just unnecessary premature optimization. But on the other hand usually all systems have some performance need and refactoring it later into multithreading safe operations is hard or even just economically not possible bec...

Insert takes too long, code optimization needed

I have some code I use to transfer a table1 values to another table2, they are sitting in different database. It's slow when I have 100.000 records. It takes forever to finish, 10+ minutes. (Windows Mobile smartphone) What can I do? cmd.CommandText = "insert into " + TableName + " select * from sync2." + TableName+""; cmd.Execute...

Need help optimizing this database query...

I was hoping I could get some help optimizing this query for a rails site: Vacation has_many :departures has_many :photos Departure belongs_to :vacation Photo belongs_to :vacation I need to find a list of vacations ordered and displayed by departure. So if a vacation has two departures, it should show up in the list twice (once for...

What is the Fastest Way to Check for a Keyword in a List of Keywords in Delphi?

I have a small list of keywords. What I'd really like to do is akin to: case MyKeyword of 'CHIL': (code for CHIL); 'HUSB': (code for HUSB); 'WIFE': (code for WIFE); 'SEX': (code for SEX); else (code for everything else); end; Unfortunately the CASE statement can't be used like that for strings. I could use the straight IF ...

When is the optimization really worth the time spent on it?

After my last question, I want to understand when an optimization is really worth the time a developer spends on it. Is it worth spending 4 hours to have queries that are 20% quicker? Yes, no, maybe, yes if...? Is 'wasting' 7 hours to switch a task to another language to save about 40% of the CPU usage 'worth it'? My normal iteration ...

How to use GetNumaProximityNode (Win7+)?

Starting with Win7/Server2008R2 the GetNumaProximityNode(Ex) function is available. It should help retrieve the distance between NUMA nodes, but I can't understand from the documentation (http://msdn.microsoft.com/en-us/library/ms683206(VS.85).aspx) how it's supposed to work. It says that you give it a distance, and it returns the corres...