| 571 | } |
| 572 | |
| 573 | double arrayPush() { |
| 574 | const int count = 1000000; |
| 575 | char *baseBuffer = static_cast<char*>(malloc(count*4*sizeof(uint64_t))); |
| 576 | char *buffer = baseBuffer; |
| 577 | |
| 578 | uint64_t start = Cycles::rdtsc(); |
| 579 | for (int i = 0; i < count; ++i) { |
| 580 | *reinterpret_cast<uint64_t*>(buffer) = 1; |
| 581 | buffer += sizeof(uint64_t); |
| 582 | |
| 583 | *reinterpret_cast<uint64_t*>(buffer ) = 2; |
| 584 | buffer += sizeof(uint64_t); |
| 585 | |
| 586 | *reinterpret_cast<uint64_t*>(buffer) = 3; |
| 587 | buffer += sizeof(uint64_t); |
| 588 | |
| 589 | *reinterpret_cast<uint64_t*>(buffer) = 4; |
| 590 | buffer += sizeof(uint64_t); |
| 591 | } |
| 592 | uint64_t stop = Cycles::rdtsc(); |
| 593 | |
| 594 | free(baseBuffer); |
| 595 | return Cycles::toSeconds(stop - start)/count; |
| 596 | } |
| 597 | |
| 598 | double arrayStructCast() |
| 599 | { |