execution-time

Java anonymous class efficiency implications

Is there any difference in efficiency (e.g. execution time, code size, etc.) between these two ways of doing things? Below are contrived examples that create objects and do nothing, but my actual scenarios may be creating new Threads, Listeners, etc. Assume the following pieces of code happen in a loop so that it might make a difference...

C++ count time overcoming 72 minutes range of clock_t

Hello, I'm trying to count the execution time of part of my application, but since I need to get milliseconds, and I need to get long execution times too. I'm currently using clock_t = clock() from ctime, but it has a range of only 72 minutes I think, which is not suitable for my needs. Is there any other portable way to count large exec...

Calculate Execution TIme using C++, rather than using <time.h>

I need to calculate the execution time of a C++ program. I am currently using the c-style head, <time.h> with the following code: clock_t tStart = clock(); ... printf("Execution Time: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC); Is there a c++ header I can use to calculate execution time? Please note this needs to be cross-pl...

Difference between Rscript and littler

...besides the fact that Rscript is invoked with #!/usr/bin/env Rscript and littler with #!/usr/local/bin/r (on my system) in first line of script file. I've found certain differences in execution speed (seems like littler is a bit slower). I've created two dummy scripts, ran each 1000 times and compared average execution time. Here's...

How to measure x86 and x86-64 assembly commands execution time in processor cycles?

I want to write a bunch of optimizations for gcc using genetic algorithms. I need to measure execution time of an assembly functions for some stats and fit functions. The usual time measurement can't be used, 'cause it is influenced by the cache size. So I need a table where I can see something like this. command | operands | operands s...

Running 100+ MySQL Update Queries. Optimization Tips Please :)

I'm working on this game titled "Fortress", located at http://www.joemajewski.com/fortress. Anyways, it's one of those browser-based role-playing games where players build an army and upgrade their stats to get a high ranking on the leaderboard. Every 30 minutes a cron job is going to execute, which makes some updates. It loops through ...

Most efficient way of getting the next unused id

(related to http://stackoverflow.com/questions/3439571/finding-the-lowest-unused-unique-id-in-a-list and http://stackoverflow.com/questions/2116056/getting-unused-unique-values-on-a-sql-table) Suppose I have a table containing on id column and some others (they don't make any difference here): +-----+-----+ | id |other| +-----+-----+ ...

Measure execution time in C#

I want to measure the execution of a piece of code and I'm wondering what the best method to do this is? Option 1: DateTime StartTime = DateTime.Now; //Code TimeSpan ts = DateTime.Now.Subtract(StartTime); string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Millisecond...

Getting the actual (absolute) execution time of the last query in PHP (excluding network latency etc)

I want to get the actual Mysql query execution times while they run in my project so running PHP microtime() before and after and subtracting won't work. When we run a query in command line, the result displays the timing information something like this:- xxx rows affected in YY sec How to get the same time information using PHP. I s...