couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Katz <>
Subject Re: NIFs and pre-R14B Erlang
Date Fri, 25 Mar 2011 06:49:26 GMT
Nice. Reading that it looks like at runtime init code can check the Erlang
version and not attempt to load the nif library on Erlang old versions,
falling back to pure erlang code there. Cool.

So then the only remaining problem is the compiling and linking on the
older Erlangs where nifs aren't available or are incompatible. We'll need
to add something to the build system to deal with that so we don't get
build failures.


On 3/24/11 11:37 PM, "Adam Kocoloski" <> wrote:

>On Mar 24, 2011, at 9:01 PM, Damien Katz wrote:
>> After discovering the huge amounts of CPU we spend parsing and encoding
>> JSON, I've been working on getting big num support into Paul Davis's
>> NIF parser so we can include it in CouchDB a get nice performance win.
>> really loving the NIF interface and it's potential to give us
>> boosts in CouchDB's CPU intensive areas. With the NIF support, we are
>> going to see a much faster CouchDB.
>> However, the problem is they don't work pre R14B.
>> So to include NIF functions and get the gains, either we need to raise
>> minimal Erlang version of trunk CouchDB for R14B, OR  have both a slow
>> erlang version of the NIF for older version, and fast NIF version for
>> newer versions and a way to load the different versions. Maybe the NIF
>> system has that stuff built in, or maybe we can do it somehow with the
>> build system.
>> Since this is trunk, we'll be raising the minimal version of something
>> like 1.2, not 1.0.3, for example. Anyway, wanted to get that out there
>> see what people think about how to handle it.
>> -Damien
>I have no qualms about raising the minimum required Erlang version, but I
>thought NIFs naturally allowed for pure-Erlang alternative
>implementations.  From
>> [A]ll NIFs of a module must have an Erlang implementation as well.
>>Normally these are minimal stub implementations that throw an exception.
>>But it can also be used as fallback implementations for functions that
>>do not have native implemenations on some architectures.
>Regards, Adam

View raw message