Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
48 lines (39 loc) · 1.48 KB

File metadata and controls

48 lines (39 loc) · 1.48 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2013 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
typedef unsigned int uint32;
int cmp_uint(const void *i1, const void *i2) {
if (*static_cast<const uint32*>(i1) >
*static_cast<const uint32*>(i2))
return 1;
if (*static_cast<const uint32*>(i1) <
*static_cast<const uint32*>(i2))
return -1;
return 0;
}
int main() {
clock_t start = clock();
const size_t TIMES = 10000;
for (size_t i = 0; i < TIMES; i++) {
const size_t num = 100;
uint32 rnd[num] = { \
407, 236, 765, 529, 24, 13, 577, 900, 242, 245, \
782, 972, 514, 100, 596, 470, 680, 65, 370, 788, \
44, 330, 579, 314, 914, 399, 100, 945, 992, 412, \
308, 102, 895, 529, 216, 422, 851, 778, 28, 804, \
325, 975, 961, 623, 922, 667, 141, 755, 416, 575, \
712, 503, 174, 675, 14, 647, 544, 881, 858, 621, \
26, 283, 460, 252, 146, 16, 571, 570, 14, 143, \
674, 985, 477, 386, 932, 490, 611, 127, 702, 619, \
104, 892, 58, 635, 663, 424, 714, 740, 229, 538, \
167, 181, 193, 193, 657, 778, 217, 573, 764, 745};
qsort(rnd, num, sizeof(uint32), cmp_uint);
}
clock_t end = clock();
float diff = (((float)end - (float)start) / CLOCKS_PER_SEC ) * 1000;
printf("cost %fms\n", diff);
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.