[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8124) Patch "Context for compare functions"



rouzier@gmail.com wrote:
> Full_Name: James Rouzier
> Version: LMDB mdb.master
> OS: N/A
> URL: https://github.com/rouzier/openldap/commit/33f1dc8be4a8503e78930f130ff9c8e5aa9bfa7b
> Submission from: (NULL) (70.81.32.80)
>
>
> New feature inclusion request: "Context for compare functions"
>
> I am finishing up a new perl module which is a very thin wrapper for LMDB.
> (The current perl LMDB module does not fit my needs as it does not support
> NO_TLS really support).
>
> When looking at mdb_set_compare and mdb_set_dupsort.
>
> There were three choices.
>
> * Not support mdb_set_compare, mdb_set_dupsort in the module.
> * Capture each mdb_*(del|put|get) function to figure which dbi I am using.
> * Add support for contexts in the compare functions.
>
> So I decided on the latter.
>
> I understand that passing a context for each compare can add some overhead.
> So I made this feature optional it is only enabled if the macro MDB_CMP_CTX is
> enabled.

I don't see supporting compare functions in interpreted languages being 
a realistic/worthwhile thing to do. The difference in performance is 
orders of magnitude.

I also don't believe such conditional compilation is a good idea. LMDB 
is designed to be simple, to have very few options, and to Just Work the 
same on every platform. Conditionally compiled features are horrible 
because you can't guess which features will be present in a 
system-installed library.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/