I am trying to optimize a function which does binary search of strings in Javascript.
Binary search requires you to know whether the key is == the pivot or < the pivot.
But this requires two string comparisons in Javascript, unlike in C like languages which have the strcmp() function that returns three values (-1, 0, +1) for (less than...
I know tree is a well studied structure.
I'm writing a program that randomly generates many expression trees and then sorts and selects by a fitness atribute.
I have a class MakeTreeInOrder() that turns the tree into a string that 'eval' can evaluate.
but it gets called many many times, and should be optimized for time.
below is a ...
The question
Is there a known benchmark or theoretical substantiation on the optimal (rendering speed wise) image size?
A little background
The problem is as follows: I have a collection of very large images, thousands of pixels wide in each dimension. These should be presented to the user and manipulated somehow. In order to improve ...
OK, so concatenations of constant string expressions are optimized by the compiler into one string. Great.
Now with string concatenation of strings only known at runtime, why does the compiler not optimize string concatenation in loops and concatenations of say more than 10 strings to use StringBuilder.Append instead? I mean, it's possi...
Can optimizing compiler delete infinite loops, which does not changes any data, like
while(1)
/* noop */;
From analyzing a data flow graph compiler can derive, that such loop is "dead code" without any side effects.
Is deleting of infinite loops prohibited by C90/C99 standards?
Does C90 or C99 standards permit compiler to deletin...
I'm doing a "select sum(foo) from bar" query on a MySQL database that's summing up 7.3mm records and taking about 22 seconds per run. Is there a trick to speeding up sums in MySQL?
...
I have a JAVA process that runs every day and takes about 1,000 or 2,000 hits before it is fully optimized by the JIT. What I'd like to do is save the JIT info so that the next day it can start in an optimized state. It seems like this should be possible, but I have not been able to find any method for doing so.
...
I'm trying to implement a genetic algorithm that will calculate the minimum of the Rastrigin functon and I'm having some issues.
I need to represent the chromosome as a binary string and as the Rastrigin's function takes a list of numbers as a parameter, how can decode the chromosome to a list of numbers?
Also the Rastrigin's wants the e...
I have been looking into optimizing a website and specifically looking into CSS sprites, and serving static resources from a subdomain (static.mysite.com). Reference: Split Components Across Domains
We are using cassini (which comes with visual studio) for development and it does not support subdomains. My static resources are contained...
Using reflector I have noticed that System.Linq.Enumerable.Count method has a condition in it to optimize it for the case when the IEnumerable<T> passed is in fact an ICollection<T>. If the cast succeeds the Count method does not need to iterate over every element, but can call the Count method of ICollection.
Based on this I was starti...
In Visual Studio > Build > Configuration Manager you can choose the target platform.
What does it change?
Is there any other way I can optimize my .NET app when targeting x64 platforms?
...
Consider the following code:
class A
{
B* b; // an A object owns a B object
A() : b(NULL) { } // we don't know what b will be when constructing A
void calledVeryOften(…)
{
if (b)
delete b;
b = new B(param1, param2, param3, param4);
}
};
My goal: I need to maximize performance, which, ...
I have strings formatted as follows:
path/to/a/filename.txt
Now I'd like to do some string manipulation which allows me to very efficiently remove the "filename.txt" part from this code. In other words, I want my string to become this:
path/to/a/
What's the most efficient way to do this? Currently I'm splitting the string and reconnect...
I'm working on an embedded project and I'm trying add more structure to some of the code, which use macros to optimize access to registers for USARTs. I'd like to organize preprocessor #define'd register addresses into const structures. If I define the structs as compound literals in a macro and pass them to inline'd functions, gcc has...
I am new to mysql and I have been pulling my hair out about this problem for days. I need to improve/optimize this query so that it runs faster - right now its taking over 5 seconds.
Here is the query:
SELECT SQL_NO_CACHE COUNT(*) as multiple, a.*,b.*
FROM announcements as a
INNER JOIN stores as s
ON a.username=s.username
...
Hi I am testing a .NET website with Trace Enabled and everything seems normal, to me, except one thing:
Category Message From First(s) From Last(s)
aspx.page End Load 4,69992678581181 4,699362
This seems like an extraordinarily large number for 'End Load'.
I am clueless as to how to use a Trace result correctly, ...
Ok, I've been sitting in front of profiler results over the last three days, generated by running a pretty wide range of test cases through an automation suite. The idea is to see if there are any good optimisations that can generally improve performance. I'll qualify good in this context as follows;
Has the potential for performance...
I have a huge amount of PHP objects for a neural network for which I have to iterate over and perform some maths on. I was wondering if I would be better off using an associative array over instances of classes?
I am dealing with around 3640 objects and iterating around 500 times (at best) on top of that so any micro-optimization helps ...
I'm having some memory problems with an application, but it's a bit difficult to figure out exactly where it is. I have two sets of data:
Pageviews
The page that was requested
The time said page was requested
Memory use
The amount of memory being used
The time this memory use was recorded
I'd like to see exactly which pageviews...
An index on two columns can be created with either of the statements
create index foo_ix on foo(a,b);
create index foo_ix on foo(b,a);
How does this affect the operational (runtime) characteristics of using the index?
How does this affect the layout (physical) characteristics of the index?
Are either (1) or (2) affected by the types/...