rendered paste body#include <irrlicht/irrlicht.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/time.h>using namespace irr;using namespace scene;using namespace video;static struct timeval tick;static void settime() { gettimeofday(&tick, NULL);}static void gettime() { struct timeval tmp; gettimeofday(&tmp, NULL); int usec = (tmp.tv_sec - tick.tv_sec) * 1000000; usec += (tmp.tv_usec - tick.tv_usec); printf("%d\n", usec); settime();}int main(int argc, char **argv) { IrrlichtDevice *dev = createDevice(EDT_NULL); IMeshCache *c = dev->getSceneManager()->getMeshCache(); IAnimatedMesh *t, *m = dev->getSceneManager()->addArrowMesh("first"); t = m; unsigned int rounds = 10000, i; char name[10]; if (argv[1]) rounds = atoi(argv[1]); printf("\n\tDoing %u test rounds. Numbers in usecs.\n\n", rounds); printf("Adding meshes: "); settime(); for (i = 0; i < rounds; i++) { sprintf(name, "%u", i); c->addMesh(name, m); } gettime(); printf("Searching: "); for (i = 0; i < rounds*2; i+=2) { sprintf(name, "%u", i); c->getMeshByName(name); } gettime(); printf("Deleting: "); for (i = 0; i < rounds; i++) { sprintf(name, "%u", i); m = c->getMeshByName(name); c->removeMesh(m); } gettime(); m = t; printf("Add-search cycles: "); for (i = 0; i < rounds; i++) { sprintf(name, "%u", i); c->addMesh(name, m); c->getMeshByName(name); } gettime(); dev->drop(); return 0;}