Why is a CPU branch instruction slow?

A branch instruction is not inherently slower than any other instruction. However, the reason you heard that branches should avoided is because modern CPUs follow a pipeline architecture. This means that there are multiple sequential instructions being executed simultaneously. But the pipeline can only be fully utilised if it’s able to read the next instruction … Read more

Is it possible to set custom CPU throttling in Chrome DevTools?

Custom values for Emulation.setCPUThrottlingRate can be set right in Chrome, but you need to open a Dev Tools window on the Dev Tools window to change the setting programatically. Open Dev Tools; make sure it is detached (open in its own window). Open Dev Tools again on the Dev Tools window from step 1 using … Read more

CPUID implementations in C++

Accessing raw CPUID information is actually very easy, here is a C++ class for that which works in Windows, Linux and OSX: #ifndef CPUID_H #define CPUID_H #ifdef _WIN32 #include <limits.h> #include <intrin.h> typedef unsigned __int32 uint32_t; #else #include <stdint.h> #endif class CPUID { uint32_t regs[4]; public: explicit CPUID(unsigned i) { #ifdef _WIN32 __cpuid((int *)regs, (int)i); … Read more

AES-NI intrinsics enabled by default?

The flag has a default of true and it will be set to false if the detection fails, so you can simply use +PrintFlagsFinal to see if it is used: My Laptop without AES-NI: C:\>”C:\Program Files\Java\jdk1.7.0_51\bin\java” -XX:+PrintFlagsFinal -version | find “UseAES” bool UseAES = false {product} bool UseAESIntrinsics = false {product} java version “1.7.0_51” Java(TM) … Read more