text-encoding-detector - performance optimization