couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <>
Subject Re: NIFs and pre-R14B Erlang
Date Fri, 25 Mar 2011 06:37:31 GMT
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 JSON
> NIF parser so we can include it in CouchDB a get nice performance win. I'm
> really loving the NIF interface and it's potential to give us performance
> 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 the
> 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 and
> 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