summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-20 04:35:35 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-20 04:35:35 +0000
commit7d605dda5a653c4c40be6de10853d6945457324a (patch)
treeb6c70d7347846a546ffa0fc8a522cd57c5f6d7d2 /src/tests
parentd223fcaba3660e8c4d61c9136311064898e23ae9 (diff)
downloadlibbu++-7d605dda5a653c4c40be6de10853d6945457324a.tar.gz
libbu++-7d605dda5a653c4c40be6de10853d6945457324a.tar.bz2
libbu++-7d605dda5a653c4c40be6de10853d6945457324a.tar.xz
libbu++-7d605dda5a653c4c40be6de10853d6945457324a.zip
Sigh, I don't know that Bu::String is slower, but it looks like std::string is
faster. Oh well.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/string.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tests/string.cpp b/src/tests/string.cpp
index 12ce8a8..b37460e 100644
--- a/src/tests/string.cpp
+++ b/src/tests/string.cpp
@@ -59,7 +59,7 @@ void doTimings()
59 Bu::String fs1, fs2; 59 Bu::String fs1, fs2;
60 std::string ss1, ss2; 60 std::string ss1, ss2;
61 double dStart, dEnd, tfs1, tfs2, tfs3, tss1, tss2, tss3; 61 double dStart, dEnd, tfs1, tfs2, tfs3, tss1, tss2, tss3;
62 int nChars = 500000, nChunks=5000, nCopies=5000000, nChunkSize=1024*4; 62 int nChars = 50000000, nChunks=50000, nCopies=500000000, nChunkSize=1024*4;
63 char *buf = new char[nChunkSize]; 63 char *buf = new char[nChunkSize];
64 memset( buf, '!', nChunkSize ); 64 memset( buf, '!', nChunkSize );
65 65
@@ -106,21 +106,21 @@ void doTimings()
106 tss3 = dEnd-dStart; 106 tss3 = dEnd-dStart;
107 107
108 printf( 108 printf(
109 "Results: singles: chunks: copies:\n" 109 "Results: singles: chunks: copies:\n"
110 "Bu::String %10.2f/s %10.2f/s %10.2f/s\n" 110 "Bu::String %15.2f/s %15.2f/s %15.2f/s\n"
111 "std::string %10.2f/s %10.2f/s %10.2f/s\n", 111 "std::string %15.2f/s %15.2f/s %15.2f/s\n",
112 nChars/tfs1, nChunks/tfs2, nCopies/tfs3, 112 nChars/tfs1, nChunks/tfs2, nCopies/tfs3,
113 nChars/tss1, nChunks/tss2, nCopies/tss3 ); 113 nChars/tss1, nChunks/tss2, nCopies/tss3 );
114 114
115 delete[] buf; 115 delete[] buf;
116} 116}
117 117
118#define pem printf("---------\n%08tX: %s\n%08tX: %s\n", (ptrdiff_t)str.getStr(), str.getStr(), (ptrdiff_t)str2.getStr(), str2.getStr() ); 118#define pem printf("---------\n%08tX: %s\n%08tX: %s\n", (ptrdiff_t)str.getConstStr(), str.getConstStr(), (ptrdiff_t)str2.getConstStr(), str2.getConstStr() );
119int main( ) 119int main( )
120{ 120{
121 Bu::String fs1; 121// Bu::String fs1;
122 for( int j = 0; j < 500000; j++ ) fs1 += (char)('a'+(j%26)); 122// for( int j = 0; j < 500000; j++ ) fs1 += (char)('a'+(j%26));
123 return 0; 123// return 0;
124 124
125 Bu::String str("th"); 125 Bu::String str("th");
126 126