optimization

Is it faster to normalize this table?

I have two tables, like these: Table People: VARCHAR Name INTEGER Age Table Message VARCHAR Message VARCHAR Name There are hundreds of insert and delete going on with the Message table with queries like this: insert into Message VALUES ('Hello there', 'John'); delete from Message where name = 'John'; My question is, is it worth whi...

What is /optimize C# compiler key intended for?

Is there a full list of optimizations done by the /optimize C# compiler key available anywhere? EDIT: Why is it disabled by default? Is it worth using in a real-world app? -- it is disabled by default only in Debug configuration and Enabled in Release. ...

Improving my file i/o algorithm

For a given set of text files, I need to find every "\" character and replace it with "\\". This is a Windows system, and my scripting language options are Javascript, VBScript, or Perl. These files are largish (~10MB a piece), and there are a good number of them (~15,000). I've already come up with the following Javascript: function...

Optimize MySQL table to tables import

Hello, I have written an importer which copies data from a flat table into several other tables, mapping them by a given XML. This is for a shop database, where each products can have several properties and each property can have several different languages, meaning it pretty fast sums up to a whole lot of data. There are over 50,000 r...

How can I optimize this simple PHP script?

This first script gets called several times for each user via an AJAX request. It calls another script on a different server to get the last line of a text file. It works fine, but I think there is a lot of room for improvement but I am not a very good PHP coder, so I am hoping with the help of the community I can optimize this for speed...

C++0x performance improvements

One of the C++0x improvements that will allow to write more efficient C++ code is the unique_ptr smart pointer (too bad, that it will not allow moving through memmove() like operations: the proposal didn't make into the draft). What are other performance improvements in upcoming standard? Take following code for example: vector<char *>...

MySQL query randomly takes "forever"

...

Linq to SQL : Optimizing queries with Sql Server Compact Edition

Hi I've been using Linq to SQL against Sql Server CE. Database is read only, so I can have several assumptions. In order to refrain from accessing the file system, my initial approach was to cache needed entities to application memory and using linq to objects against them. While it works well for limited queries, directly using Linq...

Efficient (cycles wise) algorithm to compute modulo 25?

Hi, I have a code in which i am computing x % 25. x always takes a positive value but its dynamic range is large. I found out that this particular code piece of computing a x % 25 is taking large cycles. I need to optimize it. Pre-computed lookup table is ruled out due to the possible large memory size of the table. As second appro...

Is it useful in C# to apply DeMorgan's theorem to manually optimize boolean expressions in conditional statements (e.g. if conditions)

Back in the day when I did most of my work in C and C++, as a matter of course, I would manually apply deMorgan's theorem to optimize any non-trivial boolean expressions. Is it useful to do this in C# or does the optimizer render this unnecessary? ...

Help requested: what's a fast way to bounce between lists and tuples in python?

I'm working on a script that takes the elements from companies and pairs them up with the elements of people. The goal is to optimize the pairings such that the sum of all pair values is maximized (the value of each individual pairing is precomputed and stored in the dictionary ctrPairs). They're all paired in a 1:1, each company has...

Is there an automated way to remove XAML default properties?

Are there any automated tools that will parse through XAML code and clean out values that are explicitly declared to their defaults? Example: <Grid Margin="0,0,0,0" Height="Auto" Width="Auto"> I would expect to be reduced to: <Grid> ...

Fastest way to copy a KeyedCollection

I'm working on a C# object copy constructor, part of which involves copying the contents of a KeyedCollection into a new KeyedCollection. This is what I have implemented currently: class MyKeyedCollection : KeyedCollection<uint, DataObject> { protected override uint GetKeyForItem( DataObject do ) { return do.Key; } }...

Tools for JPEG optimization?

Do you know of any tools (preferrably command-line) to automatically and losslessly optimize JPEGs that I could integrate into our build environment? For PNGs I'm currently using PNGOUT, and it generally saves around 40% bandwidth/image size. At the very least, I would like a tool that can strip metadata from the JPGs - I noticed a stra...

Contact graph

For a physics engine I'm building, I need to quickly determine if two rigid bodies were in contact, at the previous frame. I want it to be as fast as possible, so maybe you guys could provide some ideas? This is what I've got so far. (And it works okay, but the whole thing got me wondering how I could improve it.) // I thought usin...

Could this tile blitter get any faster?

When I make a tile-based map editor in C#, I tend to iterate over the X,Y axes and call Graphics.DrawImage() to blit a single tile in place, from a tileset Bitmap onto a map Bitmap. This process takes several seconds to complete, so I only do it once when loading a new map or changing its tileset. Any edits from there on are relatively f...

MySQL query help: how to deal with data in most-recent-row-per-day from a big dataset

Hi everyone, I have a somewhat complicated assortment of tables for which I need to do some SQL query construction/optimization. Currently a lot of the logic being used to obtain the results we need is being done at the app layer, which is resulting in terrible performance due to full table traversals, etc. SQL is not my strong suit, ...

Will optimizing code become unnecessary?

If Moore's Law holds true, and CPUs/GPUs become increasingly fast, will software (and, by association, you software developers) still push the boundaries to the extent that you still need to optimize your code? Or will a naive factorial solution be good enough for your code (etc)? ...

how to optimize this query in MYSQL?

mysql> explain select a.id,a.title from users c -> straight_join iask a on c.id=a.uid -> straight_join ianswer b on a.id=b.iaskid -> -> where (c.last_check is null or b.created>c.last_check) and c.id in (1,2) -> ...

how to automatically determine which tables need a vacuum / reindex in postgresql

i've written a maintenance script for our database and would like to run that script on whichever tables most need vacuuming/reindexing during our down time each day. is there any way to determine that within postgres? i would classify tables needing attention like this: tables that need vacuuming tables that need reindexing (we find ...