I want to know this info to reduce my code size so I will not waste my time optimize things that will be done by compiler or JIT.
for example:
if we assume the compiler inline the call to the get function of a property so I do not have to save the return value in a local variable to avoid function call.
I want to recommend a good ref...
For a videogame I'm implementing in my spare time, I've tried implementing my own versions of sinf(), cosf(), and atan2f(), using lookup tables. The intent is to have implementations that are faster, although with less accuracy.
My initial implementation is below. The functions work, and return good approximate values. The only probl...
I am writing a small program to display current time on iPhone (learning :D). I came across this confusion.
Is calling currentSystemTime ( eg: stringFromDate: ) on every second, parse it and print the time on screen is good?
Would it be more effective to call the above routine once and manually update the parsed second every tick of yo...
Is there a site that provides a great list of common C++ optimization practices?
What I mean by optimization is that you have to modify the source code to be able to run a program faster, not changing the compiler settings.
...
When dealing with double data types is multiplying by the inverse better or worse?
Which way is faster?
Which way uses less memory?
Which way is preferred?
How does MSIL handle this?
SquareInches = MMSquared / 645.16
SquareInches = MMSquared * 0.0015500031000062000124000248000496
NB: 10K users will note that this is a duplica...
Is everything under the GAC precompiled (ngened)? If so, then all of .NET is precompiled, so it's not possible for the CLR to optimize them at runtime?
Like if you use List in your application then CLR will not be able to optimize the List itself, but only how it's used in your app? Doesn't this defeat the purpose of JIT, to get lots of...
When constructing LINQ expressions (for me, linq to objects) there are many ways to accomplish something, some much, much better and more efficient than others.
Is there a good way to "tune" or optimize these expressions?
What fundamental metrics do folks employ and how do you gather them?
Is there a way to get at "total iterations...
Lets say we have a negative integer say
int a;
is there a faster implementation of
-a?
Do I have to do some bitwise operation on this?
...
Is there a simple tutorial for me to get up to speed in SSE, SSE2 and SSE3 in GNU C++? How can you do code optimization in SSE?
...
I have a legacy firmware application that requires new functionality. The size of the application was already near the limited flash capacity of the device and the few new functions and variables pushed it over the edge. Turning on compiler optimization does the trick, but the customer is wary of doing so because they have caused failure...
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like:
for (i=0; i < a_len; i++) {
if (a[i] == 0) {
a[i] = f1(a[i]);
} else if (a[i] % 2 == 0) {
a[i] = f2(a[i]);
} else {
a[i...
I wanted to start a optimization thread.
I have ran into an interesting situation, I have an iPhone app with 3 UITableViews each displaying more or less the same data (you can say it's a matter of filering). To date I had 3 separate NIBs for this, each with it's own controller, additionaly the UITableViews were inside UINavigationContr...
I'm maintaing an older Java code base (jvm 1.4) that seems to use cloning as an alternative to object instantiation, I'm guessing as a performance optimization. Here's a contrived example:
public class Foo {
private SomeObject obj; // SomeObject implements Cloneable
public Foo() {
obj = new SomeObject();
obj.setField1("abc")...
Given the following Xml fragment:
<root>
<sheetData>
<row r="1" />
<row r="2" />
<row r="3" />
<row r="4" />
<row r="5" />
<row r="6" />
<row r="7" />
</sheetData>
</root>
Which can be created with the following code:
XElement testElement = new XElement("root",
new XElement("sheetData",
new...
This is a follow up to my question "Efficiently storing 7.300.000.000 rows" (http://stackoverflow.com/questions/665614/efficiently-storing-7-300-000-000-rows).
I've decided to use MySQL with partitioning and the preliminary schema looks like this:
CREATE TABLE entity_values (
entity_id MEDIUMINT UNSIGNED DEFAULT 0 NOT NULL, # 3 bytes...
I have a query
select * into NewTab from OpenQuery(rmtServer, 'select c1, c2 from rmtTab')
When I look at the execution plan, it tells me that it performs a 'Table Spool/Eager Spool' that 'stores the data in a temporary table to optimize rewinds'
Now I don't anticipate any rewinds. If there is a crash of some sort, I can just drop ...
I have a large number of strings to process in php. I want to "fix" them to be title case (using ucwords(strtolower($str))) but only if they are all upper or all lower case already. If they are already mixed case, I'd just rather just leave them as they are.
What is the fastest way to check for this? It seems like foring through the ...
Is there a way to tell the compiler (g++ in my case) to not optimize certain code away, even if that code is not reachable? I just want those symbols in the object file.
Example: Here is a simple function, and I do want this function to be compiled, even if it's never called.
void foo(){
Foo<int> v;
}
If there is no official compil...
I'm writing a small algorithm in PHP that goes through n number of movies with ratings, and will store the top 5. I'm not reading from a datafile, but from a stream so I cannot simply order the movies by rating.
My question is what is the most efficent way to keep track of the top 5 rated movies as I read the stream? Currently I do the ...
Hello,
I witnessed the following weird behavior. I have two functions, which do almost the same - they measure the number of cycles it takes to do a certain operation. In one function, inside the loop I increment a variable; in the other nothing happens. The variables are volatile so they won't be optimized away. These are the functions...