diff options
author | miloyip <miloyip@gmail.com> | 2014-07-17 13:47:51 +0400 |
---|---|---|
committer | miloyip <miloyip@gmail.com> | 2014-07-17 13:47:51 +0400 |
commit | 74a135678a9994be50cab0cd9ef0b899b2753f57 (patch) | |
tree | 385de69553289aa1425dfff69029930dfdb3c54a /test | |
parent | e1cdf1229e69c9dab929eb9e033d5a4cc40c99da (diff) |
Add VC itoa perf comparison
Diffstat (limited to 'test')
-rw-r--r-- | test/perftest/misctest.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/perftest/misctest.cpp b/test/perftest/misctest.cpp index f1be6590..f844fb71 100644 --- a/test/perftest/misctest.cpp +++ b/test/perftest/misctest.cpp @@ -422,7 +422,7 @@ private: };
template<>
-inline bool Writer1<rapidjson::StringBuffer>::WriteUint(unsigned u) {
+bool Writer1<rapidjson::StringBuffer>::WriteUint(unsigned u) {
char buffer[10];
char* p = buffer;
do {
@@ -953,6 +953,32 @@ TEST_F(Misc, itoa64_sprintf) { OUTPUT_LENGTH(length);
}
+#ifdef _MSC_VER
+TEST_F(Misc, itoa_VC) {
+ size_t length = 0;
+ for (size_t i = 0; i < kItoaTrialCount; i++) {
+ for (size_t j = 0; j < randvalCount; j++) {
+ char buffer[32];
+ _itoa(randval[j], buffer, 10);
+ length += strlen(buffer);
+ }
+ }
+ OUTPUT_LENGTH(length);
+}
+
+TEST_F(Misc, itoa64_VC) {
+ size_t length = 0;
+ for (size_t i = 0; i < kItoaTrialCount; i++) {
+ for (size_t j = 0; j < randvalCount; j++) {
+ char buffer[32];
+ _i64toa(randval[j] * randval[j], buffer, 10);
+ length += strlen(buffer);
+ }
+ }
+ OUTPUT_LENGTH(length);
+}
+#endif
+
TEST_F(Misc, itoa_strtk) {
size_t length = 0;
std::string s;
|