optimization

Strange Mysql Query Performance on View

I have a view : vcompanyendofday The following query executes in just 0.7 secs Select * from vcompanyendofday But a simple where condition to this query takes around 200.0 secs select * from vcompanyendofday where companyid <= 51; This is the view definition: CREATE VIEW `vcompanyendofday` AS select `c`.`companyid` AS...

What is a Bookmark Lookup in Sql Server?

I'm in the process of trying to optimize a query that looks up historical data. I'm using the query analyzer to lookup the Execution Plan and have found that the majority of my query cost is on something called a "Bookmark Lookup". I've never seen this node in an execution plan before and don't know what it means. Is this a good thi...

Should AcceptChanges() be called every time a new row is added?

Which is recommended while (reader.Read()) { table.Rows.Add( new object[] { reader[0], reader[1], reader[2], reader[3] } ); table.AcceptChanges(); } or while (reader.Read()) { table.Rows.Add( new object[] { reader[0], reader[1], reader[2], reader[3] } ); } table.AcceptChanges(); ...

WPF PathGeometry/RotateTransform optimization

I am having performance issues when rendering/rotating WPF triangles If I had a WPF triangle being displayed and it will be rotated to some degree around a centrepoint, I can do it one of two ways: Programatically determine the points and their offset in the backend, use XAML to simply place them on the canvas where they belong, it wo...

Compiler Optimizations Questions

What are some of the ways a compiler eliminates repeated subexpressions recomputations? How do you keep track of the sub-expressions? And How do you identify the repeated ones? Besides the usage of bitwise operators, what are some of the strength reduction techniques common compilers use? ...

Neural Net Optimize w/ Genetic Algorithm

Is a genetic algorithm the most efficient way to optimize the number of hidden nodes and the amount of training done on an artificial neural network? I am coding neural networks using the NNToolbox in Matlab. I am open to any other suggestions of optimization techniques, but I'm most familiar with GA's. ...

Would this SingleOrDefault() optimization be worthwhile or is it overkill / harmful?

I was messing around with LinqToSQL and LINQPad and I noticed that SingleOrDefault() doesn't do any filtering or limiting in the generated SQL (I had almost expected the equivalent of Take(1)). So Assuming you wanted to protect yourself from large quantities accidentally being returned, would the following snippet be useful or is it a...

Optimizing Class Size in Delphi. Is there something like "packed classes"?

I'm trying to optimize the size of my Delphi classes so that they take up as less memory as possible cause I'm creating a great number of them. The thing is, the classes themselves are pretty small but they aren't taking the space I was expecting. For example if I have type MyClass = class private mMember1 : integer; mMember2...

Confused about three optimization techniques

How do you exactly perform "commoning"? How does Kleene fixed-point theorem help in optimization? How do you eliminate free variables from local function definitions in programs written in non-functional languages? EDIT: These are NOT my homework questions. I am in my summer break. EDIT2: Well I am just begininng to study compiler...

Optimize SQL Stored Procedure

A stored procedure that runs a SELECT on a large table is timing out. The where clause is causing the timeout, because I am selecting only cities that are in another table. AND city IN (SELECT DISTINCT city from tOH where clientId = @clientId) AND state IN (SELECT DISTINCT state from tOH where clientId = @clientId) *note almost alway...

SQL queries taking too long

I'm using ADO to save data to an MS Access database. It was taking quite a while to save the data to file (about 7 seconds - which is too long for our purposes). I looked at the number of SQL queries being run, and it's about 4200; although there isn't a whole heap of data. The database connection seems to be the bottleneck. Do you know...

Slow but simple Query, how to make it quicker?

I have a database which is 6GB in size, with a multitude of tables however smaller queries seem to have the most problems, and want to know what can be done to optimise them for example there is a Stock, Items and Order Table. The Stock table is the items in stock this has around 100,000 records within with 25 fields storing ProductCode,...

Hiccups in OpenGL ES. What is the correct implementation?

I'm using OpenGL ES to make a game on the iPhone. Unfortunately, I see small (and irregular) hiccups. I use a timer with a sleep, calling the draw function every 60th of a second, in order to garantee a solid frame rate. I've tried to change the moment in time my timer awakens from its sleep, giving the draw function more time to exec...

MySQL Query optimisation

I am currently working on a website which needs some optimisations ... since the front page takes about 15-20 seconds to be loaded I thought that some optimisation would be nice. Here is one query that appeared on the MySQL slow query log: SELECT a.user,a.id FROM `profil_perso` pp INNER JOIN `acces` a ON pp.parrain = a.id INNER JOIN `a...

Perplexing STL bug in Release in Visual Studio.

I have what I'm pretty sure is a bug in the optimizer in Visual studio 2005. The problem is with an STL map. Here's the relevant code: MyMapIterator myIt = m_myMap.find(otherID); if (myIt != m_myMap.end() && myIt->second.userStatus == STATUS_A) { //Prints stuff. No side-effects whatsoever. } else if (myIt != m_myMap.end() && myIt->...

What is the method for optimizing individual functions in a file in GCC 4.1.1?

Various C / C++ compilers have #pragmas to control optimization. For example: CodeWarrior #pragma optimization_level 0 void func_no_opt() { // Some Work - not optimized } #pragma optimization_level 3 void func_full_opt() { // Some Work - optimized } MSVC #pragma optimize("g", off) void func_no_opt() { // Some Work - no...

Fastest way to enumerate through turned on bits of an integer

What's the fastest way to enumerate through an integer and return the exponent of each bit that is turned on? Have seen an example using << and another using Math.Pow. Wondering if there is anything else that's really fast. Thanks. ...

How much should I worry about the Intel C++ compiler emitting suboptimal code for AMD ?

We've always been an Intel shop. All the developers use Intel machines, recommended platform for end users is Intel, and if end users want to run on AMD it's their lookout. Maybe the test department had an AMD machine somewhere to check we didn't ship anything completely broken, but that was about it. Up until a few of years ago we ju...

Large buffers vs Large static buffers, is there an advantage?

Hello, Consider the following code. Is DoSomething1() faster then DoSomething2() in a 1000 consecutive executions? I would assume that if I where to call DoSomething1() it 1000 times it would be faster then calling DoSomething2() it 1000 times. Is there any disadvantage to making all my large buffers static? #define MAX_BUFFER_LENGTH...

zero Functor construction and overhead even with new and delete?

If I have a functor class with no state, but I create it from the heap with new, are typical compilers smart enough to optimize away the creation overhead entirely? This question has come up when making a bunch of stateless functors. If they're allocated on the stack, does their 0 state class body mean that the stack really isn't change...