Code review comment for lp:~zorba-coders/zorba/treeidapi

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

It seems to me that the change you are proposing is adding a lot of overhead. Especially for the simple store, a ulong with simple arithmetic operations has been replaced with a class containing several virtual functions.

I propose the following alternative solution which we should consider:

- make the SimpleStore and XmlNode template classes
- introduce typedefs to keep the textual changes minimal
- the template parameters are the TreeId that should be used and a traits class providing the required operations for the TreeId
- in the simplestore,
  - the type of the TreeId would be ulong
  - the traits class would implement the basic operations very efficiently (e.g. + operator or < with ulongs)
- in some other store,
  - the type of the TreeId could be a uuid
  - the traits class would implement the operations on top of uuids

This way, the simplestore's code that is actually executed (i.e. there is no runtime overhead). Also, once this extension mechanism is in place, other dynamic extensions (e.g. factories) could be replaced also in order to avoid even more runtime overhead.

review: Needs Information

« Back to merge proposal