Java program runs slower when code that is never executed is commented out

The commented code affects how inlining is handled. If functionB gets longer/bigger (more bytecode instructions) it will not be inlined into functionA. So @J3D1 was able to use VMOptions to manually switch off inlining for functionB(): -XX:CompileCommand=dontinline,com.jd.benchmarking.StrangeBeh‌​aviour::functionB This appears to eliminate the delay with the shorter function. with the vm options you can display inlining … Read more

Building a promise chain recursively in javascript – memory considerations

a call stack and a promise chain – ie “deep” and “wide”. Actually, no. There is no promise chain here as we know it from doSomeThingAsynchronous.then(doSomethingAsynchronous).then(doSomethingAsynchronous).… (which is what Promise.each or Promise.reduce might do to sequentially execute handlers if it was written this way). What we are facing here is a resolve chain1 – what … Read more

Jquery Ajax beforeSend and success,error & complete

Maybe you can try the following : var i = 0; function AjaxSendForm(url, placeholder, form, append) { var data = $(form).serialize(); append = (append === undefined ? false : true); // whatever, it will evaluate to true or false only $.ajax({ type: ‘POST’, url: url, data: data, beforeSend: function() { // setting a timeout $(placeholder).addClass(‘loading’); … Read more

C# Recursion Depth – How Deep can you go

I’ve increased the stack size during some documents recognition. It was really needed. So you can increase stack size for thread using following code: var stackSize = 10000000; Thread thread = new Thread(new ThreadStart(BigRecursion), stackSize); Thread(ThreadStart, Int32) — Initializes a new instance of the Thread class, specifying the maximum stack size for the thread. Source … Read more

Does CUDA support recursion?

It does on NVIDIA hardware supporting compute capability 2.0 and CUDA 3.1: New language features added to CUDA C / C++ include: Support for function pointers and recursion make it easier to port many existing algorithms to Fermi GPUs http://developer.nvidia.com/object/cuda_3_1_downloads.html Function pointers: http://developer.download.nvidia.com/compute/cuda/sdk/website/CUDA_Advanced_Topics.html#FunctionPointers Recursion: I can’t find a code sample on NVIDIA’s website, but on … Read more