Writting Custom FPrintF : I have to make my own fprintf method in c++, but by comparing the execution time of my method with the standard one, mine is almost 3 times slower. What have I done wrong?

`void FPrintF(const char *aFormat, ...) { 	va_list ap; 	const char *p; 	int count = 0; 	char buf[16]; 	std::string tbuf; 	va_start(ap, aFormat); 	for (p = aFormat; *p; p++) 	{ 		if (*p != '%') 		{ 			continue; 		} 		switch (*++p) 		{ 		case 'd': 			sprintf(buf, "%d", va_arg(ap, int32)); 			break; 		case 'f': 			sprintf(buf, "%.5f", va_arg(ap, double)); 			break; 		case 's': 			sprintf(buf, "%s", va_arg(ap, const char*)); 			break; 		} 		*p++; 		const uint32 Length = (uint32)strlen(buf); 		buf[Length] = (char)*p; 		buf[Length + 1] = '\0'; 		tbuf += buf; 	} 	va_end(ap); 	Write((char*)tbuf.c_str(), tbuf.size()); }`
