awesome perf improvements and sampling tricks