Is it possible to force an existing Java application to use no more than x cores?

It’s called setting CPU affinity, and it’s an OS setting for processes, not specific to Java. On Linux: http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html On Windows: http://www.addictivetips.com/windows-tips/how-to-set-processor-affinity-to-an-application-in-windows/ On Mac it doesn’t look like you can set it: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x

Benchmarking VBA Code

The following code uses a windows function that is more accurate than Excel. It is taken from http://msdn.microsoft.com/en-us/library/aa730921.aspx#Office2007excelPerf_MakingWorkbooksCalculateFaster. The same page also contains some great tips on improving performance in Excel 2007. Private Declare Function getFrequency Lib “kernel32” _ Alias “QueryPerformanceFrequency” (cyFrequency As Currency) As Long Private Declare Function getTickCount Lib “kernel32” _ Alias “QueryPerformanceCounter” … Read more

Why is iterating though `std::vector` faster than iterating though `std::array`?

The difference is due to memory pages of array not being resident in process address space (global scope array is stored in .bss section of the executable that hasn’t been paged in, it is zero-initialized). Whereas vector has just been allocated and zero-filled, so its memory pages are already present. If you add std::fill_n(v.data(), n, … Read more