optimization

optimize a string.Format + replace.

I have this function. The visual studio profile marked the line with string.Format as hot and were i spend much of my time. How can i write this loop more efficiently? public string EscapeNoPredicate(string sz) { var s = new StringBuilder(sz); s.Replace(sepStr, sepStr + sepStr); foreach (char v in Illeg...

while Reseting auto increment for a particular table, query is taking long time to update in MYSQL

"ALTER TABLE tablename AUTO_INCREMENT = 10000000 " taking long time to update. why? i need to get optimize this query. Please help ...

Optimizing texture swapping on opengles for the iPhone

I have 2 1024x1024 sprite sheets, one containing several 480x320 background images and another containing a variety of smaller elements as entities and interface. My framerate drops like a rock whenever I enter a scene in which I have to display sprites from both textures (forcing me to re-bind twice per frame, interface texture->bg text...

Is possible to reuse subqueries?

Hello, I'm having some problems trying to perform a query. I have two tables, one with elements information, and another one with records related with the elements of the first table. The idea is to get in the same row the element information plus several records information. Structure could be explain like this: table [ id, name ] [...

gcc memory alignment pragma

hello. Does gcc have memory alignment pragma, akin #pragma vector aligned in Intel compiler? I would like to tell compiler to optimize particular loop using aligned loads/store instructions. to avoid possible confusion, this is not about struct packing. e.g: #if defined (__INTEL_COMPILER) #pragma vector aligned #endif for (in...

MySQL efficiency as it relates to the database/table size

I'm building a system using django, Sphinx and MySQL that's very quickly becoming quite large. The database currently has about 2000 rows, and I've written a program that's going to populate it with another 40,000 rows in a couple days. Since the database is live right now, and since I've never had a database with this much information i...

Mysql Server Optimization

Hi Geeks, We are having serious MySQL(InnoDB) performance issues at a moment when we do: (10-20) insertions on TABLE1 (10-20) updates on TABLE2 Note: Both above operations happens within fraction of a second. And this occurs every few (10-15) minutes. And all online users (approx 400-600) doing read operation on join of TABLE1 & TA...

WPF, how can I optimize lines and circles drawing ?

Hello ! I am developping an application where I need to draw a graph on the screen. For this purpose, I use a Canvas and I put Controls on it. An example of such a draw as shown in the app can be found here : http://free0.hiboox.com/images/1610/d82e0b7cc3521071ede601d3542c7bc5.png It works fine for simple graphs, but I also want to b...

How to optimise MySQL query containing a subquery?

I have two tables, House and Person. For any row in House, there can be 0, 1 or many corresponding rows in Person. But, of those people, a maximum of one will have a status of "ACTIVE", the others will all have a status of "CANCELLED". e.g. SELECT * FROM House LEFT JOIN Person ON House.ID = Person.HouseID House.ID | Person.ID | Person...

Read large amount of data from file in Java

Hello I've got text file that contains 1 000 002 numbers in following formation: 123 456 1 2 3 4 5 6 .... 999999 100000 Now I need to read that data and allocate it to int variables (the very first two numbers) and all the rest (1 000 000 numbers) to an array int[]. It's not a hard task, but - it's horrible slow. My first attempt ...

Common causes of slow performing jQuery and how to optimize the code?

Possible Duplicates: Javascript (jQuery) performance measurement and best practices (not load time) Good ways to improve jQuery selector performance? Hello, This might be a bit of a vague or general question, but I figure it might be able to serve as a good resource for other jQuery-ers. I'm interested in common causes o...

Equivalence of PHP includes in Iphone dev ?

Hey guys, I just noticed I get a lot of redondant code from one class to another in my project (like menus or buttons) ;) Is there any way to optimize it ? Thank you ! Gotye. ...

Results from two queries at once in sqlite?

I'm currently trying to optimize the sluggish process of retrieving a page of log entries from the SQLite database. I noticed I almost always retrieve next entries along with count of available entries: SELECT time, level, type, text FROM Logs WHERE level IN (%s) ORDER BY time DESC, id DESC LIMIT LOG_...

WPF: Improving Performance for Running on Older PCs

So, I'm building a WPF app and did a test deployment today, and found that it performed pretty poorly. I was surprised, as we are really not doing much in the way of visual effects or animations. I deployed on two machines: the fastest and the slowest that will need to run the application (the slowest PC has an Intel Celeron 1.80GHz wi...

why optimization does not happen?

hi. I have C/C++ code, that looks like this: static int function(double *I) { int n = 0; // more instructions, loops, for (int i; ...; ++i) n += fabs(I[i] > tolerance); return n; } function(I); // return value is not used. compiler inlines function, however it does not optimize out n manipulations. I would ex...

Is there any significant benefit to reading string directly from control instead of moving it into a variable?

sqlInsertFrame.Parameters.AddWithValue("@UserName", txtUserName.txt); Given the code above...if I don't have any need to move the textbox data into a string variable, is it best to read the data directly from the control? In terms of performance, it would seem smartest to not create any unnecessary variables which use up memory if it...

How to optimize my game calendar in C#?

Hi, I've implemented a simple calendar (message system) for my game which consists from: 1) List<Event> calendar; 2) public class Event { /// <summary> /// When to process the event /// </summary> public Int64 when; /// <summary> /// Which object should process the event /// </summary> public Gam...

Pragmas swp,ivdep,prefetch support in various compilers

Hello In good Altix manual (altix_single_cpu_optimization) I've found this list of pragmas-hints for optimizing compilers #pragma ivdep // no aliasing #pragma swp // try to software-pipeline #pragma noswp // disable software-pipelining #pragma loop count (NN) // hint for SWP #pragma distr...

nested function call faster or not ?

I have this silly argument with a friend and need an authoritative word on it. I have these two snippet and want to know which one is faster ? [A or B] (assuming that compiler does not optimize anything) [A] if ( foo () ); [B] int t = foo (); if ( t ) EDIT : Guys, this might look a silly question to you but I have a hardware ...

Complicated idea - how to create car racing for my RPG game's players

So, I want to create car racing for my RPG game's players. Player can create race and choose how many participants can participate in race. After race is being created, other people can join it. When the maximum participants are collected, race begins. My idea, when the last participant joins, then instantly choose the winner (who's ca...