GRASS Programmer's Manual
6.5.svn(2014)-r66266
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
speed.c
Go to the documentation of this file.
1
/*
2
** Written by David Gerdes US Army Construction Engineering Research Lab
3
** April 1992
4
** Copyright 1992 USA-CERL All rights reserved.
5
**
6
*/
7
8
/*
9
** This is a simple best case performance comparison between linkm and malloc
10
*/
11
#include <stdio.h>
12
#include <grass/linkm.h>
13
14
struct
link
15
{
16
char
let
;
17
struct
link
*
next
;
18
};
19
20
/*
21
#define LINKM
22
*/
23
24
int
main
(
int
argc,
char
*argv[])
25
{
26
register
int
i;
27
VOID_T
*head;
28
struct
link
List, *tmp, *p;
29
int
rev = 0;
30
31
32
33
#ifdef LINKM
34
head = (
VOID_T
*)
link_init
(
sizeof
(
struct
link
));
35
#endif
36
37
38
for
(i = 0; i < 2000000; i++) {
39
#ifdef LINKM
40
p = (
struct
link
*)
link_new
(head);
41
link_dispose
(head, p);
42
#else
43
p = (
struct
link
*)
malloc
(
sizeof
(
struct
link
));
44
free
(p);
45
#endif
46
}
47
48
#ifdef LINKM
49
link_cleanup
(head);
50
#endif
51
52
exit(0);
53
}
VOID_T
#define VOID_T
Definition:
qtree.h:17
link_init
struct link_head * link_init(int size)
Definition:
linkm/init.c:40
link_new
struct link_head * link_new(struct link_head *Head)
Definition:
new.c:12
link::next
struct link * next
Definition:
linkm.c:21
link_cleanup
void link_cleanup(struct link_head *Head)
Definition:
linkm/init.c:64
malloc
void * malloc(YYSIZE_T)
link::let
char let
Definition:
linkm.c:20
main
int main(int argc, char *argv[])
Definition:
gem/main.c:302
link_dispose
void link_dispose(struct link_head *Head, VOID_T *ptr)
Definition:
dispose.c:10
free
void free(void *)
link
Definition:
linkm.c:18
lib
linkm
speed.c
Generated on Sat Jan 2 2016 01:46:49 for GRASS Programmer's Manual by
1.8.5