Optimize #upperfix performance using native extensions