optimization

What are good, freely available SSA/SCCP resources?

This is what I could come up with so far: gcc related: SSA for Trees Tree SSA – A New Optimization Framework for GCC Tree SSA A New Optimization Infrastructure for GCC Design and Implementation of Tree SSA Other: An Implementation of Sparse Conditional Constant Propagation for Machine SUIF Concurrent Static Single Assignment Form ...

How can I repaint efficiently when using big custom component in Swing?

I have made a custom component (derived from JComponent) which represents a draggable Bezier-curve. (looks like a hanging cable, someone might know it from Bender or Cubase) My problem is: The curve may become really long, let's say from top left to bottom right corners of the desktop. This makes Swing's repaint functionality inefficie...

Is there anything I can do to make "help" load faster in Visual Studio 2008?

Loading Help or clicking F1 in Visual Studio is horribly slow to load and has been on ever PC I have installed it on. Is there any optimizations that can be employed to ease this pain? This is not the same question as Visual Studio Optimizations I am just trying to solve the problem with help loading. ...

SQL order of operations

If I run the following SQL query SELECT * FROM A LEFT JOIN B ON A.foo=B.foo WHERE A.date="Yesterday" Does the WHERE statement get evaluated before or after the join? If after, what would be a better way to write this statement so that only rows in A from "Yesterday" are joined to B. ...

Can I tell Perl that some data are immutable to speed things up?

Perl is really good for writing the kind of string/file parsing programs that I usually need to do. What I really love is the insignificant amount of time it takes me to write quick scripts and throwaway code, compared to C/C++/JAVA. However, I want to learn how to speed things up. For example, I would want to learn how to give hints to...

Improve my function: generate SEO friendly title

I am using this function to generate SEO friendly titles, but I think it can be improved, anyone want to try? It does a few things: cleans common accented letters, check against a "forbidden" array, and check optionally against a database of titles in use. /** * Recursive function that generates a unique "this-is-the-title123" string ...

java servlet : how to speed this up?

I have the following function which is called for every line item produced. Does anyone have any ideas how to speed this up? private String getDetails(String doc){ String table=""; java.sql.ResultSet rs = qw.DBquery("select " + "id,LineType, QtyTotal, ManufacturerPartNumber, Description, UnitCost,UnitPrice " + ...

while (1) Vs. for (;;) Is there a speed difference?

Long version... A co-worker asserted today after seeing my use of while (1) in a Perl script that for (;;) is faster. I argued that they should be the same hoping that the interpreter would optimize out any differences. I set up a script that would run 1,000,000,000 for loop iterations and the same number of while loops and record the ...

How would you optimize the following query.

I am using the following query to find out to top 6 viewed pages in my Drupal site: SELECT n.title, n.nid, c.daycount FROM node n JOIN node_counter c ON n.nid=c.nid WHERE n.type='page' AND n.status = 1 ORDER BY c.daycount DESC LIMIT 0,6; This is very natural and works well on most sites. However, on a site with many nodes (1.7m), ...

When to use -O2 flag for gcc?

If I use "-O2" flag, the performance improves, but the compilation time gets longer. How can I decide, whether to use it or not? Maybe O2 makes the most difference in some certain types of code (e.g. math calculations?), and I should use it only for those parts of the project? EDIT: I want to emphasize the fact that setting -O2 for ...

Which piece of code is more performant?

Hi folks, I have some code i'm revewing, which is used to convert some text into an MD5 Hash. Works great. It's used to create an MD5Hhash for a gravatar avatar. Here it is :- static MD5CryptoServiceProvider md5CryptoServiceProvider = null; public static string ToMD5Hash(this string value) { //creating only when needed if (md5...

How to determine the accuracy of Pi (π)

Optimizing a game we're developing, we're running into the phase where every CPU cycle won counts. We using radians for position calculations of objects circling around other objects and I want to cut the needless accuracy in my lookup tables. For that, we make heavy use of a predefined Pi. How accurate should this Pi be? So, my questio...

C# Better way to detect XML?

Currently, i have the following c# code to extract a value out of text. If its xml, i want the value within it - otherwise, if its not xml, it can just return the text itself. String data = "..." try { return XElement.Parse(data).Value; } catch (System.Xml.XmlException) { return data; } I know exceptions are expensive in C#, ...

Including file in PHP ?

I am developing an application where I have a requirement that I have to include multiple files, as follows: File1.php will include File2.php File2.php will include File3.php File3.php will include File4.php Now, what will be the best and optimized way of doing these. I tried with include() but I think its slowing down my server as ...

How do I optimize this method for breaking a string in chunks?

Here's the method. I want to know if I am violating any best practices here or if I am doing something wrong as far as the language is concerned. private List<String> breakStringInChunks(String text, int chunkSize) { List<String> chunks = new ArrayList<String>(); String temporary = ""; int numberOfChunks = text.l...

C++: optimizing member variable order?

I was reading a blog post by a game coder for Introversion and he is busily trying to squeeze every CPU tick he can out of the code. One trick he mentions off-hand is to "re-order the member variables of a class into most used and least used." I'm not familiar with C++, nor with how it compiles, but I was wondering if This sta...

Insight on a query optimization

I am trying here to basically find users that do have sports & regions targeted by an activity. In the acces [users] table there is around 17K users. Each can have a certain number of sport interests and one region. There query here look for each users that have one sport & one region at least that are targeted via the activities. Spor...

What are some good code optimization methods?

I would like to understand good code optimization methods and methodology. How do I keep from doing premature optimization if I am thinking about performance already. How do I find the bottlenecks in my code? How do I make sure that over time my program does not become any slower? What are some common performance errors to avoid (e.g.;...

DataTables vs List(Of Object)

I'm having a debate with another programmer I work with. Are there any significant memory usage or performance differences, or other cons which should make someone avoid using the DataTable and favour lists(of object)... or vice versa I prefer using the lists because they are more lightweight, strong typing to the object when accessing...

Most accurate line intersection ordinate computation with floats ?

I'm computing the ordinate y of a point on a line at a given abscissa x. The line is defined by its two end points coordinates (x0,y0)(x1,y1). End points coordinates are floats and the computation must be done in float precision for use in GPU. The maths, and thus the naive implementation, are trivial. Let t = (x - x0)/(x1 - x0), then...