i have such code
var prj = _dataContext.Project.FirstOrDefault(p => p.isPopular == true);
if (prj != null)
{
prj.isPopular = false;
_dataContext.SaveChanges();
}
prj = Details(id);
prj.isPopular = true;
_dataContext.SaveChanges();
idea-i have only one re...
I have implemented a Genetic Algorithm to solve the Traveling Salesman Problem (TSP). When I use only mutation, I find better solutions than when I add in crossover. I know that normal crossover methods do not work for TSP, so I implemented both the Ordered Crossover and the PMX Crossover methods, and both suffer from bad results.
Here...
Is there a method to automatically find the best compiler options (on a given machine), which result in the fastest possible executable?
Naturally, I use g++ -O3, but there are additional flags that may make the code run faster, e.g. -ffast-math and others, some of which are hardware-dependent.
Does anyone know some code I can put in...
Is there a way to see how many context switches each thread generates? (both in and out if possible) Either in X/s, or to let it run and give aggregated data after some time.
(either on linux or on windows)
I have found only tools that give aggregated context-switching number for whole os or per process.
My program makes many context s...
Lets say I have a function where the parameter is passed by value instead of const-reference. Further, lets assume that only the value is used inside the function i.e. the function doesn't try to modify it. In that case will the compiler will be able to figure out that it can pass the value by const-reference (for performance reasons) an...
I was making sure I knew how to do the op= and copy constructor correctly in order to sort() properly, so I wrote up a test case. After getting it to work, I realized that the op= was hard-copying all the data_.
I figure if I wanted to sort a container with this structure (its elements have heap allocated char buffer arrays), it'd be fa...
Hi.
I wanted to know is C# array has a constant access speed?
I need to store 1000 items in static array, that will be initialized during server startup. This array will be used readonly,
so there will be no changes to array.
Should I use a simple C# array (new MyClass[]) or Dictionary instead.
I am really new to C# and trying to unders...
I'm looking for a faster way to calculate GC content for DNA strings read in from a FASTA file. This boils down to taking a string and counting the number of times that the letter 'G' or 'C' appears. I also want to specify the range of characters to consider.
I have a working function that is fairly slow, and it's causing a bottleneck...
Sorry if this is too simple, but thanks in advance for helping. This is for MySQL but might be relevant for other RDMBSs
tblA has 4 columns: colA, colB, colC, mydata, A_id
It has about 10^9 records, with 10^3 distinct values for colA, colB, colC.
tblB has 3 columns: colA, colB, B_id
It has about 10^4 records.
I want all the records fr...
I've just come to the end of a large development project. We were on a tight timeline, so a lot of optimization was "deferred". Now that we met our deadline, we're going back and trying to optimize things.
My questions is this: What are some of the most important things you look for when optimizing jQuery web sites. Alternately I'd love...
When measuring performance on my query I came up with a dependency between isolation level and elapsed time that was surprising to me
READUNCOMMITTED - 409024
READCOMMITTED - 368021
REPEATABLEREAD - 358019
SERIALIZABLE - 348019
Left column is table hint, and the right column is elapsed time in microseconds (sys.dm_exec_query_stats.tot...
I have built an open-source application from the source code. Unfortunately, the original executable runs significantly faster. I tried to enable few compiler optimizations, but the result wasn't satisfactory enough. What else do I need to make in Visual Studio 2008 to increase the executable performance?
Thanks!
...
I have this mysql table called comments which looks like this:
commentID parentID type userID date comment
The commentID is set as Primary key, but most of the time I fetch the data using the parentID. How should I set my indexes?
Should I just add an index on parentID and let commentID be the primary key?
Edit: Would it be bad to h...
My native C++ COM component uses ATL. In DllRegisterServer() I call CComModule::RegisterServer():
STDAPI DllRegisterServer()
{
return _Module.RegisterServer(FALSE); // <<< notice FALSE here
}
FALSE is passed to indicate to not register the type library.
ATL is available as sources, so I in fact compile the implementation of CComM...
I have an Oracle SQL query as part of a stored proc:
DELETE FROM item i
WHERE NOT EXISTS (SELECT 1 FROM item_queue q WHERE q.n=i.n)
AND NOT EXISTS (SELECT 1 FROM tool_queue t WHERE t.n=i.n);
A bit about the tables:
item contains about 10k rows with an index on the n column
item_queue contains about 1mil rows also with index on n...
I wrote a php script to stick in my page just before my main stylesheet.
The idea is to split all the background images needed by my page across a few different subdomains so that I can use more than two parallel HTTP requests (latency is horrible from Australia to American hosting).
I know that this requires resolving extra DNS lookup...
I'm working on a PHP web application that let's users network with each other, book events, message etc... I launched it a few months ago and at the moment, there's only about 100 users.
I set up the application on a VPS with ubuntu 9.10, apache 2, mysql 5 and php 5. I had 360 Mb of RAM, but upgraded to 720 MB a few minutes ago.
Late...
I'm doing some performance tuning and capacity planning for a low-latency application and have the following question:
What is the theoretical minimum round-trip time for a packet sent between a host in London and one in New York connected via optical fiber?
...
Lets say I'm going to save 100 floating point numbers in a list by running a single script, most probably it will take some memory to process.So if this code executes every time as a requirement of an application there will be performance hits, so my question is how to maintain efficiency in order to gain performance.
Mock-up code:
def...
In every benchmark that I found on the web it seems that Ruby is slow, much slower than Java. The Ruby folks just state that it doesn't matter. Could you give me any example that the speed of Ruby on Rails (and the Ruby itself) really doesn't matter?
...