I need your help to optimize the query to avoid using "Using filesort".The job of the query is to select all the articles that belongs to specific tag. The query is:
select title
from tag,
article
where tag = 'Riyad'
AND tag.article_id = article.id
order by tag.article_id
The tables structure are the followi...
What of these two methods is in C more efficient? And how about:
pow(x,3) vs. x*x*x etc?
...
I have a small doubt
I have following code
bool res= false;
if(cond1)
{
res = true;
}
if(cond2)
{
res = true;
}
Instead of this if I put following code
if(cond1 || cond2)
{
res = true;
}
Which code snippet will be more optimized?
I believe it would be second one as I have avoided an If condition.
...
I'm working on a Sudoku solver at school and we're having a little performance contest. Right now, my algorithm is pretty fast on the first run (about 2.5ms), but even faster when I solve the same puzzle 10 000 times (about 0.5ms for each run). Those timing, of course, depend of the puzzle being solved. I know the JVM do some optimizatio...
I have an optimizer that solves a transportation problem, using a cost matrix of all the possible paths.
The optimiser works fine, but if two of the costs are equal, the solution contains one more path that the minimum number of paths. (Think of it as load balancing routers; if two routes are same cost, you'll use them both.)
I would l...
We are using a table with a structure imposed upon us more than 10 years ago. We are allowed to add columns, but urged not to change existing columns.
Certain columns are meant to represent dates, but are put in different format. Amongst others:
* CHAR(6): YYMMDD
* CHAR(6): DDMMYY
* CHAR(8): YYYYMMDD
* CHAR(8): DDMMYYYY
* DATE
* ...
This question is close to this:
http://stackoverflow.com/questions/2947963/find-the-period-of-over-speed
Here's my table:
Longtitude Latitude Velocity Time
102 401 40 2010-06-01 10:22:34.000
103 403 50 2010-06-01 10:40:00.000
104 405 0 2010-06-01...
Hello guys,
Recently i've been improving traditional genetic algorithm for multiknapsack problem. So My Improved Genetic Algorithm is working better then Traditional Genetic Algorithm. I tested. (i used publically available from OR-Library (http://people.brunel.ac.uk/~mastjjb/jeb/orlib/mknapinfo.html) were used to test the GAs.) Does any...
I'm trying to compare some code samples for speed, and I decided to use the OpenMP timer since I'll eventually be multi threading the code.
The timer works great on two of my four code snippets, but not on the other two
start=omp_get_wtime();
/*code here*/
finish = omp_get_wtime() - start_time;
The four code here sections are serial ...
Is there anything wrong with the optimization of overloading the global operator new to round up all allocations to the next power of two? Theoretically, this would lower fragmentation at the cost of higher worst-case memory consumption, but does the OS already have redundant behavior with this technique, or does it do its best to conser...
Hi all,
I wanted to calculate the angle between two vectors but I have seen these inverse trig operations such as acos and atan uses lots of cpu cycles. Is there a way where I can get this calculation done without using these functions? Also, does these really hit you when you in your optimization?
...
Here is a peace of code:
void MyFunc(List<MyObj> objects)
{
MyFunc1(objects);
foreach( MyObj obj in objects.Where(obj1=>obj1.Good))
{
// Do Action With Good Object
}
}
void MyFunc1(List<MyObj> objects)
{
int iGoodCount = objects.Where(obj1=>obj1.Good).Count();
BeHappy(iGoodCount);
// do other stuff with 'objects' co...
I have an auto-generated file which looks something like this...
static void do_SomeFunc1(void* parameter)
{
// Do stuff.
}
// Continues on for another 4000 functions...
void dispatch(int id, void* parameter)
{
switch(id)
{
case ::SomeClass1::id: return do_SomeFunc1(parameter);
case ::SomeClass2::id: return...
I have a database with thousands of companies and their locations. I have implemented n-grams to optimize search. I am making one query to retrieve all the companies that match with the search query and another one to get a list with their locations and the number of companies in each location.
The query I am trying to optimize is the l...
Hi,
I'm working with R and I have a code like this:
for (i in 1:10)
for (j in 1:100)
if (data[i] == paths[j,1])
cluster[i,4] <- paths[j,2]
where :
data is a vector with 100 rows and 1 column
paths is a matrix with 100 rows and 5 columns
cluster is a matrix with 100 rows and 5 columns
My question is: how cou...
We have a .NET application which our customers consider too large for mass deployment and we would like to understand what contributes to our memory footprint and is it possible to do any better without completely abandoning .NET and wpf.
We are interested in improving both Total Size and the Private Working Set (pws). In this question...
I have started to use anonymous delegates a lot in C# and I have begun to wonder how efficient the complier or runtime is in removing them from the code that is actually run and I haven't seen this detailed anywhere?
Is it clever enough at all to inline them and collapse recursive uses that could be statically deduced?
...
We have a number of machines which record data into a database at sporadic intervals. For each record, I'd like to obtain the time period between this recording and the previous recording.
I can do this using ROW_NUMBER as follows:
WITH TempTable AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY Machine_ID ORDER BY Date_Time) AS Orde...
I have zlib and Zend Optimizer enabled on my server.
I have read about the
zlib.output_compression
directive. Are there any caveats with turning this directive on in my server?
...
I have a service running which periodically checks a folder for a file and then processes it. (Reads it, extracts the data, stores it in sql)
So I ran it on a test box and it took a little longer thaan expected.
The file had 1.6 million rows, and it was still running after 6 hours (then I went home).
The problem is the box it is runnin...