alloc tests
This commit is contained in:
parent
7c309f9481
commit
6e87b9ffc9
|
@ -0,0 +1,14 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
const unsigned long long MAX_I=0x00ffffff;
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long long i;
|
||||
|
||||
for (i = 0; i < MAX_I; i++)
|
||||
free(malloc(1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "malloc_speed_test.c test:"
|
||||
cc -O2 malloc_speed_test.c -o malloc_speed_test && time ./malloc_speed_test
|
||||
|
||||
echo -e "\n\nvector_add.cpp test:"
|
||||
c++ -O2 vector_add.cpp -o vector_add && time ./vector_add
|
|
@ -0,0 +1,17 @@
|
|||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
const unsigned long long MAX_I = 0x00ffffff;
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long long i;
|
||||
|
||||
vector<char> v;
|
||||
|
||||
for (i = 0; i < MAX_I; i++)
|
||||
v.push_back(0);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue