JVM JIT and running mode

JIT At the beginning of Java, all code are executed in interpreted manner, I.E execute code line by line after interpretation which would result in slowness. Especially for code that are frequently executed. So later JIT was introduced so that when when some code are frequently executed, it becomes ‘Hot Spot Code’ and would be…

GC friendly java coding

1. Give size when initing collections When initing Map/List etc, if we could know the size, pass into the constructor. This way JVM does not have to constantly allocate memory to new arrays when the size grows. 2. Use immutable Immutability has a lot of benefits. One of them is typically ignored which is its…

hoist for var, let, const, function, function*, class

I have been playing with ES6 for a while and I noticed that while variables declared with var are hoisted as expected… console.log(typeof name); // undefined var name = “John”; …variables declared with let or const seem to have some problems with hoisting: console.log(typeof name); // ReferenceError let name = “John”; and console.log(typeof name); //…

Hive Hadoop mapper size

Below is an article from MapR Hive table contains files in HDFS, if one table or one partition has too many small files, the HiveQL performance may be impacted. Sometimes, it may take lots of time to prepare a MapReduce job before submitting it, since Hive needs to get the metadata from each file. This…