J
jacob navia
Consider this benchmark
--------------------------------------------------------C++
#include <iostream>
#include <list>
using namespace std;
// Simple example uses type int
#define MAXIT 50000000
int main(void)
{
list<int> L;
int i;
for (i=0; i<MAXIT;i++)
L.push_back(i); // Insert a new element at the end
list<int>::iterator it;
int sum=0;
for (it=L.begin(); it != L.end(); ++it)
sum += *it;
printf("%d\n",sum);
return 0;
}
--------------------------------------------------------C
/* compile with list.c and containererror.c */
#include "containers.h"
#include <stdio.h>
int main(void)
{
#define MAX_IT 50000000
List *l = newList(sizeof(int));
list_element *le;
int i,sum=0;
for (i=0; i<MAX_IT; i++) {
l->lpVtbl->Add(l,&i); // Insert at the end
}
for (le = GetFirst(l); le != NULL; le = GetNext(le)) {
sum += *(int *)le->Data;
}
printf("%d\n",sum);
return 0;
}
---------------------------------------------------------
I think it would be interesting to see the results in as much
machines as possible.
Thanks
--------------------------------------------------------C++
#include <iostream>
#include <list>
using namespace std;
// Simple example uses type int
#define MAXIT 50000000
int main(void)
{
list<int> L;
int i;
for (i=0; i<MAXIT;i++)
L.push_back(i); // Insert a new element at the end
list<int>::iterator it;
int sum=0;
for (it=L.begin(); it != L.end(); ++it)
sum += *it;
printf("%d\n",sum);
return 0;
}
--------------------------------------------------------C
/* compile with list.c and containererror.c */
#include "containers.h"
#include <stdio.h>
int main(void)
{
#define MAX_IT 50000000
List *l = newList(sizeof(int));
list_element *le;
int i,sum=0;
for (i=0; i<MAX_IT; i++) {
l->lpVtbl->Add(l,&i); // Insert at the end
}
for (le = GetFirst(l); le != NULL; le = GetNext(le)) {
sum += *(int *)le->Data;
}
printf("%d\n",sum);
return 0;
}
---------------------------------------------------------
I think it would be interesting to see the results in as much
machines as possible.
Thanks