Merge "Migrate perf-critical functions away from librs."