Gradle sourceCompatibility has no effect to subprojects

It seems this behavior is caused by specifying the sourceCompatibility before apply plugin: ‘java’, which happens if you try to set the compatibility option inside allprojects. In my setup, the situation can be solved by replacing: allprojects { sourceCompatibility = 1.6 targetCompatibility = 1.6 } with: allprojects { apply plugin: ‘java’ sourceCompatibility = 1.6 targetCompatibility … Read more

Why are Java 8 lambdas invoked using invokedynamic?

Lambdas are not invoked using invokedynamic, their object representation is created using invokedynamic, the actual invocation is a regular invokevirtual or invokeinterface. For example: // creates an instance of (a subclass of) Consumer // with invokedynamic to java.lang.invoke.LambdaMetafactory something(x -> System.out.println(x)); void something(Consumer<String> consumer) { // invokeinterface consumer.accept(“hello”); } Any lambda has to become an … Read more

Why the Global Interpreter Lock?

In general, for any thread safety problem you will need to protect your internal data structures with locks. This can be done with various levels of granularity. You can use fine-grained locking, where every separate structure has its own lock. You can use coarse-grained locking where one lock protects everything (the GIL approach). There are … Read more

What is the difference between native code, machine code and assembly code?

The terms are indeed a bit confusing, because they are sometimes used inconsistently. Machine code: This is the most well-defined one. It is code that uses the byte-code instructions which your processor (the physical piece of metal that does the actual work) understands and executes directly. All other code must be translated or transformed into … Read more

C++ performance vs. Java/C#

JIT vs. Static Compiler As already said in the previous posts, JIT can compile IL/bytecode into native code at runtime. The cost of that was mentionned, but not to its conclusion: JIT has one massive problem is that it can’t compile everything: JIT compiling takes time, so the JIT will compile only some parts of … Read more