Different XP framework classloading implementations compared

at 2007-04-11 in Experiments by kiesel (0 comments)

Classloading is a very interesting topic. Classloading is a very fundamental and - at the same time - invisible thing, that nevertheless happens a million times each second (if you aggregate all instances of applications that run the XP framework).
Because it happens so often, one must take special care when modifying the framework's loading implementation. A single line more here or there can impact the framework severely.

If you then take into account that for bootstrap classloading not a single one of all the convenience providing classes from the framework is at your command and everything needs to be a) fast, b) flexible and c) working at all, you might see that this it can be quite difficult to come up with new implementations here.

In the experiment classloaders (which can be seen at http://experiments.xp-framework.net/?arena,classloaders ) the main target is to provide more reasonable ways to organize classloaders (one for each include_path element) and to provide a useful default classloader (one that can load any class - if it's available somewhere).

Because we had faced some performance penalties, I have profiled and benchmarked the current classloading code and compared it with benchmarks of the new one (from the experiment) and a scenario where you load all classes from .xar files.

This is the comparison chart of these there implementations:



It turns out that (after finding a small glitch in the new implemenation) the new implementation seems so save some IO calls and is also faster. Looking at the .xar loading you might think it is the fastest of the three, which could be correct theoretically. However, in this test series, it's actually the slowest - which comes due to the overhead of reading the .xar index first; it is probably the one method that scales the best with more classes loaded from the archive).

The average execution speed was
1. 47 ms
2. 45 ms
3. 60 ms



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases

Related

Find related articles by a search for «Different».