mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-30 08:04:04 +00:00
Kill ZT_FAST_MEMCPY in selftest.
This commit is contained in:
parent
2966eac64f
commit
97046b265c
46
selftest.cpp
46
selftest.cpp
@ -669,52 +669,6 @@ static int testOther()
|
|||||||
std::cout << " " << InetAddress("").toString(buf);
|
std::cout << " " << InetAddress("").toString(buf);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::cout << "[other] Benchmarking memcpy... "; std::cout.flush();
|
|
||||||
{
|
|
||||||
unsigned char *bb = (unsigned char *)::malloc(1234567);
|
|
||||||
unsigned char *cc = (unsigned char *)::malloc(1234567);
|
|
||||||
for(unsigned int i=0;i<1234567;++i)
|
|
||||||
bb[i] = (unsigned char)i;
|
|
||||||
double bytes = 0.0;
|
|
||||||
uint64_t start = OSUtils::now();
|
|
||||||
for(unsigned int i=0;i<20000;++i) {
|
|
||||||
++bb[i];
|
|
||||||
++bb[i+1];
|
|
||||||
memcpy(cc,bb,1234567);
|
|
||||||
bytes += 1234567.0;
|
|
||||||
}
|
|
||||||
if (cc[0] != bb[0])
|
|
||||||
abort();
|
|
||||||
uint64_t end = OSUtils::now();
|
|
||||||
std::cout << ((bytes / 1048576.0) / ((long double)(end - start) / 1024.0)) << " MiB/second" << std::endl;
|
|
||||||
::free((void *)bb);
|
|
||||||
::free((void *)cc);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::cout << "[other] Benchmarking ZT_FAST_MEMCPY... "; std::cout.flush();
|
|
||||||
{
|
|
||||||
unsigned char *bb = (unsigned char *)::malloc(1234567);
|
|
||||||
unsigned char *cc = (unsigned char *)::malloc(1234567);
|
|
||||||
for(unsigned int i=0;i<1234567;++i)
|
|
||||||
bb[i] = (unsigned char)i;
|
|
||||||
double bytes = 0.0;
|
|
||||||
uint64_t start = OSUtils::now();
|
|
||||||
for(unsigned int i=0;i<20000;++i) {
|
|
||||||
++bb[0];
|
|
||||||
++bb[1234566];
|
|
||||||
ZT_FAST_MEMCPY(cc,bb,1234567);
|
|
||||||
bytes += 1234567.0;
|
|
||||||
}
|
|
||||||
if (cc[0] != bb[0])
|
|
||||||
abort();
|
|
||||||
uint64_t end = OSUtils::now();
|
|
||||||
std::cout << ((bytes / 1048576.0) / ((long double)(end - start) / 1024.0)) << " MiB/second" << std::endl;
|
|
||||||
::free((void *)bb);
|
|
||||||
::free((void *)cc);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
std::cout << "[other] Testing Hashtable... "; std::cout.flush();
|
std::cout << "[other] Testing Hashtable... "; std::cout.flush();
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user