Chandra Sekar's Blog

Java's CompletableFuture and Threads

19 May, 2017 java / multithreading

Quiz time. How many threads (other than main) will this program create on a dual-core machine?

public class App {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            CompletableFuture.runAsync(() -> {
                System.out.println(currentThread().getName());
            }).join();
        }
    }
}

 Read more

Timing Equity MFs with PE

08 May, 2017 equity / timing / mutual-fund / pe

The rule of thumb for equity investments is to not time the market, but there are also several analyses correlating investing at high index PE levels with lower returns. So can we use the PE levels of indices to generate better returns than SIP and reduce volatility of the portfolio?

 Read more

Arena Allocation in Go

07 Jul, 2014 golang / allocation / arena

One of the weaknesses of Go’s runtime today is the relatively naive GC implementation. This is evident from go performing consistently worse than most other languages in the binary trees benchmark. However, the language can make designing programs that reduce GC cost fairly straightforward.

 Read more

Go Does Delegates Beautifully!

06 Apr, 2012 golang / ruby / delegates / java

When working with object-oriented languages, there are many instances when one would want to implement an interface re-using code from another implementation of the interface. While inheritance will work, it couples the new implementation to the specific other implementation. Composition with delegation will be a better way of doing this.

 Read more

How Git outshines Subversion at Merging

22 Jan, 2010 git / svn

I’ve recently started getting my head around Git having been a Subversion (sadly even CVS) user all along. While I liked the fact that it was distributed and way faster than Subversion at most operations, I couldn’t understand why many claimed it was better at merging than Subversion (1.5 and above). Even the “Branch Handling” section in Git’s wiki talks only about better history tracking but not about how Git is better at merging the content themselves.

 Read more

← Newer Posts   Older Posts →