support /main for compiler
some optimization. dont block ui thread