optimized compile on linux
add nanosleep on osx