LCG Project | LCG Applications Area | |
$Date: 2004/11/11 11:07:00 $ |
The goal of this exercise was to compare the sizes of the SEAL Reflex (1.4.2) and ROOT/CINT (4.01.02) dictionaries both in memory allocation and library size.
A sample dictionary of 131 CLHEP classes (1.9.1.1) was taken and loaded both in SEAL Reflex and ROOT/CINT. So produced sharable libraries were compared in terms of disk space and in terms of heap allocation with a tool from the valrgind suite, called massif.
The program executed on the SEAL Reflex version of the CLHEP dictionary
#include "Reflex/Reflex.h"
#include <iostream>
#include <unistd.h>
#include <dlfcn.h>
using namespace seal::reflex;
int main() {
size_t n = 0;
for (size_t i = 0; i < Type::typeCount(); ++i) { if ( Type::type(i)->isClass() ) { ++n; } }
std::cout << "Number of dictionary classes before loading CLHEP dictionary: " << n << std::endl;
sleep(10);
void * libInstance = dlopen("libSealCLHEPDict.2.so", RTLD_LAZY);
if (!libInstance) {
std::cout << "Could not load library" << std::endl;
return 1;
}
else {
std::cout << "Dictionary successfully loaded " << std::endl;
}
sleep(10);
n = 0;
for (size_t i = 0; i < Type::typeCount(); ++i) { if ( Type::type(i)->isClass() ) { ++n; } }
std::cout << "Number of dictionary classes after loading of CLHEP dictionary: " << n << std::endl; return 0;
}
The output of the program
Number of dictionary classes before loading CLHEP dictionary: 0
Dictionary successfully loaded
Number of dictionary classes after loading of CLHEP dictionary: 131
The program executed on the ROOT/CINT version of the CLHEP dictionary
#include <iostream>
#include <dlfcn.h>
#include <unistd.h>
#include "TClassTable.h"
#include "TROOT.h"
#include "G__ci.h"
#include "global.h"
int main() {
std::cout << "Number of dictionary classes before loading CLHEP dictionary: "
<< gClassTable->Classes() << std::endl;
sleep(10); void * libInstance = dlopen("libroot_dict.so",RTLD_LAZY);
if (!libInstance) {
std::cout << "Could not load library" << std::endl;
return 1;
}
else {
std::cout << "Dictionary successfully loaded " << std::endl;
}
sleep(10);
std::cout << "Number of dictionary classes after loading CLHEP dictionary: " << gClassTable->Classes() << std::endl;
return 0;
}
The output of the program
Number of dictionary classes before loading CLHEP dictionary: 254
Dictionary successfully loaded
Number of dictionary classes after loading CLHEP dictionary: 385
SEAL Reflex |
ROOT/CINT |
![]() |
![]() |
[ Note on the ROOT/CINT graph: ~4.5 MB of the ROOT/CINT allocation seem to be due to the bootstrapping procedure of ROOT. The allocation of the CLHEP dictionary starts at ~20.000 ms. ]
SEAL Reflex |
ROOT/CINT |
1.58 MB | 1.39 MB |
Contact: Stefan Roiser |