Re: BTrees F(32-bit C float) type

Tres Seaver <[email protected]> Thu, 14 Mar 2019 14:16:02 -0400
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
On 3/14/19 10:28 AM, Qiwen Chen wrote:
> 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.

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          [email protected]
Palladion Software   "Excellence by Design"    http://palladion.com

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.