BTrees F(32-bit C float) type

14 views
Skip to first unread message

Qiwen Chen

unread,
Mar 14, 2019, 10:28:23 AM3/14/19
to zodb
Is there an easy to extend the F (32-bit C float) type in BTrees ( such as IFBTree, LFBTree)  to a DOUBLE type?

I currently use IOBTree and LOBTree for storing double type. But I would assume it's not as efficient.

Many thanks!!

Tres Seaver

unread,
Mar 14, 2019, 2:16:13 PM3/14/19
to zo...@googlegroups.com
There is no knob to allow that. You could cobble it together yourself,
following the pattern for the float-value trees:

- Copy 'BTrees/floatvalue.h' -> 'doublevalue.h' and make the
appropriate changes (figure out which Python API calls need to change).

- Add new interfaces to 'BTrees/Interfaces.py' (IIntegerDoubleBTreeModule,
ILongDoubleBTreeMoudle)

- Copy 'BTrees/_IFBTree.c' -> '_IDBTree.c' and make appopriate changes
('#include "doublevaluemacros.h"', etc. Ditto for 'BTrees/LFBTree.c'.

- Copy 'BTrees/IFBTree.py' -> 'IDBTree.py' and make appropriate changes.
Ditto for 'BTrees/LFBTree.py'.

- Copy 'BTrees/tests/test_IFBTree.py' and make appropriate chagnes. Ditto
for 'BTrees/tests/test_LFBtree.py'. You could maybe skip this part, but
they would be required if you wanted to get your branch merged.

- Update 'setup.py' to add the new 'FLAVORS' and 'FAMILIES' values.

- Test thoroughly, including measuring RAM saved over the 'IO' / 'LO'
variants. :)

- Submit a PR with your new code.

- Profit!



Tres.
--
===================================================================
Tres Seaver +1 540-429-0999 tse...@palladion.com
Palladion Software "Excellence by Design" http://palladion.com

Reply all
Reply to author
Forward
0 new messages