execution-time

Java anonymous class efficiency implications

心已入冬 提交于 2019-11-27 08:50:21
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. Using anonymous objects: void doSomething() { for (/* Assume some loop */) { final Object obj1, obj2; // some free variables IWorker anonymousWorker = new IWorker() { doWork() { // do things that refer to obj1 and obj2 } }; } } Defining a class first: void

Loop with a zero execution time

吃可爱长大的小学妹 提交于 2019-11-27 07:02:19
Is it possible to have a loop which has a zero execution time? I would think that even an empty loop should have an execution time since there is an overhead associated with it. Shafik Yaghmour Yes, under the as-if rule the compiler is only obligated to emulate the observable behavior of the code, so if you have a loop that does not have any observable behavior then it can be optimized away completely and therefore will effectively have zero execution time. Examples For example the following code: int main() { int j = 0 ; for( int i = 0; i < 10000; ++i ) { ++j ; } } compiled with gcc 4.9 using

get execution time in milliseconds in R

落花浮王杯 提交于 2019-11-27 04:25:45
问题 I have read a solution to this using tic(), toc() functions tic <- function(gcFirst = TRUE, type=c("elapsed", "user.self", "sys.self")) { type <- match.arg(type) assign(".type", type, envir=baseenv()) if(gcFirst) gc(FALSE) tic <- proc.time()[type] assign(".tic", tic, envir=baseenv()) invisible(tic) } toc <- function() { type <- get(".type", envir=baseenv()) toc <- proc.time()[type] tic <- get(".tic", envir=baseenv()) print(toc - tic) invisible(toc) } tic(); -----code---- toc(); elapsed 0.15

JQuery grep(…) VS native JavaScript filter(…) function performance

人盡茶涼 提交于 2019-11-27 03:22:41
问题 I measured the execution times of those two functions: jQuery grep function Native JavaScript filter function The execution of following methods have been measured using Chrome Profiles tool: // jQuery GREP function function alternative1(words, wordToTest) { return $.grep(words, function(word) { return wordToTest.indexOf(word) != -1; }); } // Native javascript FILTER function function alternative2(words, wordToTest) { return words.filter(function(word) { return wordToTest.indexOf(word) != -1;

Very different execution times of SQL query in C# and SQL Server Management Studio

大兔子大兔子 提交于 2019-11-26 21:24:12
问题 I have a simple SQL query that when run from C# takes over 30 seconds then times-out every time, whereas when run on SQL Server Management Studio successfully completes instantly. In the latter case, a query execution plan reveals nothing troubling, and the execution time is spread nicely through a few simple operations. I've run ' EXEC sp_who2 ' while the query is running from C#, and it is listed as taking 29,000 milliseconds of CPU time, and is not blocked by anything. I have no idea how

How to get the execution time of a MySQL query from PHP? [duplicate]

余生颓废 提交于 2019-11-26 19:59:50
问题 This question already has answers here : mysql execution time (3 answers) Closed 6 years ago . I execute MySQL queries from PHP and would like to know how time consuming they are. Is there any way to get the execution time of a MySQL query from PHP? I also wonder if the execution time depends on how loaded is the web server. I can imagine that a query will take more time to execute if the server is busy with other queries. On the other hand, I can imagine that, if the server is busy, the

Maximum execution time in phpMyadmin

…衆ロ難τιáo~ 提交于 2019-11-26 15:39:38
When I try to execute (some) queries in phpMyadmin I get this error Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\phpmyadmin\libraries\dbi\mysql.dbi.lib.php on line 140 because I have a very large table (over 9 millions records) I have edited the file C:\xampp\php\php.ini and changed the value of "max execution time" from 60 to 1000 then restarts the PHP and still have the same error. Any solution? user1900623 I have the same error, please go to xampp\phpMyAdmin\libraries\config.default.php Look for : $cfg['ExecTimeLimit'] = 600; You can change '600' to any higher

Java anonymous class efficiency implications

放肆的年华 提交于 2019-11-26 14:11:57
问题 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. Using anonymous objects: void doSomething() { for (/* Assume some loop */) { final Object obj1, obj2; // some free variables IWorker anonymousWorker = new

How to solve time out in phpmyadmin?

。_饼干妹妹 提交于 2019-11-26 10:27:37
问题 I want import huge ( at least 300 mb) sql scripts via phpMyAdmin. I\'ve tried: post_max_size = 750M upload_max_filesize = 750M max_execution_time = 300 max_input_time = 540 memory_limit = 1000M in my php.ini file, but I\'m still getting timeout errors during importing. 回答1: If even after repeated upload you still get timeout error, pleasechange your settings in \phpmyadmin\libraries\config.default.php from $cfg['ExecTimeLimit'] = 300; to $cfg['ExecTimeLimit'] = 0; and restart. Now there is no

How to increase maximum execution time in php [duplicate]

亡梦爱人 提交于 2019-11-26 07:24:30
This question already has an answer here: Increase PHP Script Execution Time [duplicate] 1 answer I want to increase maximum execution time in php , not by changing php.ini file. I want to Increase it from my php file. Is this possible? James Scholes ini_set('max_execution_time', 300); //300 seconds = 5 minutes ini_set('max_execution_time', 0); // for infinite time of execution Place this at the top of your PHP script and let your script loose! Taken from Increase PHP Script Execution Time Limit Using ini_set() use below statement if safe_mode is off set_time_limit(0); Use the PHP function