more precise profiler and few optimizations