couchdb-jiffy.git
2 years agoMerge remote-tracking branch 'davisp/master' CouchDB-1.0.1-1
Paul J. Davis [Sun, 5 Jan 2020 20:15:39 +0000 (14:15 -0600)] 
Merge remote-tracking branch 'davisp/master'

3 years ago1.0.1 1.0.1
Paul J. Davis [Mon, 13 May 2019 17:06:45 +0000 (12:06 -0500)] 
1.0.1

3 years agoUse from_array instead of positional versions
Paul J. Davis [Mon, 13 May 2019 16:57:57 +0000 (11:57 -0500)] 
Use from_array instead of positional versions

3 years agoFix backwards compatibility
Paul J. Davis [Mon, 13 May 2019 16:53:39 +0000 (11:53 -0500)] 
Fix backwards compatibility

3 years agoRemove accidentally commited rebar state
Paul J. Davis [Mon, 13 May 2019 16:53:22 +0000 (11:53 -0500)] 
Remove accidentally commited rebar state

3 years agoFix R14 support
Paul J. Davis [Mon, 13 May 2019 14:45:34 +0000 (09:45 -0500)] 
Fix R14 support

3 years agoFix support of VMs pre-17.x
Paul J. Davis [Mon, 13 May 2019 14:39:31 +0000 (09:39 -0500)] 
Fix support of VMs pre-17.x

3 years agoFix support for Erlang 17.x
Paul J. Davis [Mon, 13 May 2019 14:37:18 +0000 (09:37 -0500)] 
Fix support for Erlang 17.x

3 years ago1.0.0 1.0.0
Paul J. Davis [Mon, 13 May 2019 14:13:54 +0000 (09:13 -0500)] 
1.0.0

3 years agoUpdate readme with the exception type change
Paul J. Davis [Mon, 13 May 2019 14:13:13 +0000 (09:13 -0500)] 
Update readme with the exception type change

3 years agoUpgrade to double-converson 3.1.4
Paul J. Davis [Mon, 13 May 2019 14:11:06 +0000 (09:11 -0500)] 
Upgrade to double-converson 3.1.4

3 years agoChange errors for bignums to be more explicit
Paul J. Davis [Mon, 13 May 2019 13:58:58 +0000 (08:58 -0500)] 
Change errors for bignums to be more explicit

Co-Authored-By: Stephan Renatus <srenatus@chef.io>
3 years agoRemove -fno-strict-aliasing
John Högberg [Thu, 11 Apr 2019 12:53:24 +0000 (14:53 +0200)] 
Remove -fno-strict-aliasing

We don't do fishy things like type punning so it really isn't
necessary, and supplying it prevents certain optimizations.

3 years agoGet rid of separate unsigned/signed buffers
John Högberg [Thu, 11 Apr 2019 11:32:45 +0000 (13:32 +0200)] 
Get rid of separate unsigned/signed buffers

3 years agoNever expand the encode buffer; emit and restart
John Högberg [Thu, 11 Apr 2019 11:30:05 +0000 (13:30 +0200)] 
Never expand the encode buffer; emit and restart

This greatly increases the performance of long string encodes as
we won't need to copy intermediate results over and over.

3 years agoFix erroneous state check in the decoder
John Högberg [Thu, 11 Apr 2019 04:39:33 +0000 (06:39 +0200)] 
Fix erroneous state check in the decoder

If the input contained a mismatched end-of-array/object, the stack
could become empty before a call to dec_curr, which would look
beyond the bounds of the stack. If the value at this invalid
position happened to be st_array, we would pop too much from the
stack and overwrite the data that came before it.

This commit fixes this by letting dec_pop return the previous
state or st_invalid if the stack is empty, letting us exit
gracefully if the state isn't what we expect it to be.

dec_pop_assert is identical to the old dec_pop, tearing down the
emulator on internal errors.

3 years agoEnable link-time optimization on *nix platforms
John Högberg [Mon, 8 Apr 2019 05:45:51 +0000 (07:45 +0200)] 
Enable link-time optimization on *nix platforms

3 years agoMove all atom checks under enif_is_atom
John Högberg [Tue, 9 Apr 2019 10:17:13 +0000 (12:17 +0200)] 
Move all atom checks under enif_is_atom

3 years agoUse the result map for key dedupe
John Högberg [Tue, 9 Apr 2019 08:17:05 +0000 (10:17 +0200)] 
Use the result map for key dedupe

This is a wee bit more cache-friendly than using a std::set with
string keys.

3 years agoRefactor trapping and trap more often during decode
John Högberg [Tue, 9 Apr 2019 07:17:17 +0000 (09:17 +0200)] 
Refactor trapping and trap more often during decode

3 years agoSkip erroneous UTF-8 validation for atoms
John Högberg [Tue, 9 Apr 2019 06:08:23 +0000 (08:08 +0200)] 
Skip erroneous UTF-8 validation for atoms

We requested atoms in latin1 and then handled them as utf-8,
erroring out on some valid atoms and performing pointless
validation on others.

3 years agoUse enif_is_identical for equality checks
John Högberg [Tue, 9 Apr 2019 05:56:21 +0000 (07:56 +0200)] 
Use enif_is_identical for equality checks

3 years agoReplace sprintf with a dedicated integer print routine
John Högberg [Tue, 9 Apr 2019 05:40:22 +0000 (07:40 +0200)] 
Replace sprintf with a dedicated integer print routine

3 years agoSkip redundant enif_is_empty_list checks during encode
John Högberg [Tue, 9 Apr 2019 05:18:34 +0000 (07:18 +0200)] 
Skip redundant enif_is_empty_list checks during encode

enif_get_list_cell fails when the list is empty.

3 years agoUse realloc instead of doing it manually
John Högberg [Tue, 9 Apr 2019 05:12:21 +0000 (07:12 +0200)] 
Use realloc instead of doing it manually

3 years agoWalk through strings once when encoding
John Högberg [Mon, 8 Apr 2019 14:04:33 +0000 (16:04 +0200)] 
Walk through strings once when encoding

3 years agoUse an array for the position stack rather than an Erlang list
John Högberg [Mon, 8 Apr 2019 10:57:16 +0000 (12:57 +0200)] 
Use an array for the position stack rather than an Erlang list

3 years agosizeof(char) == 1 by definition
John Högberg [Tue, 9 Apr 2019 10:35:03 +0000 (12:35 +0200)] 
sizeof(char) == 1 by definition

3 years ago0.15.2
Paul J. Davis [Fri, 11 May 2018 17:14:31 +0000 (12:14 -0500)] 
0.15.2

3 years agoRaise errors instead of throwing
Eric Meadows-Jönsson [Sat, 4 Jun 2016 19:59:03 +0000 (21:59 +0200)] 
Raise errors instead of throwing

3 years agoDocumentation improvement decode option copy_strings.
Andreas Krüger [Wed, 14 Mar 2018 11:29:00 +0000 (12:29 +0100)] 
Documentation improvement decode option copy_strings.

3 years agofix bug on hex escape table
Jihyun Yu [Wed, 26 Sep 2018 10:18:19 +0000 (19:18 +0900)] 
fix bug on hex escape table

number of items on `hexvals` is 128 while table size is 256, so
remaining 128 items are filled with zero. As a result, values in
\xf0-\xff will be treated as zero while should be rejected.

3 years agoFix decoding of "\uDBFF\uDFFF" surrogate pair.
David Hull [Wed, 13 Feb 2019 00:21:30 +0000 (00:21 +0000)] 
Fix decoding of "\uDBFF\uDFFF" surrogate pair.

4 years agoadd test erlang/otp 21
getong [Mon, 25 Jun 2018 12:27:40 +0000 (20:27 +0800)] 
add test erlang/otp 21

4 years agoExplicitly list xmerl for relase to include it
Martin Wiso [Fri, 11 May 2018 10:15:28 +0000 (12:15 +0200)] 
Explicitly list xmerl for relase to include it

4 years ago0.15.1 0.15.1
Paul J. Davis [Thu, 8 Mar 2018 17:09:08 +0000 (11:09 -0600)] 
0.15.1

4 years agoAdd missing option for copy strings
Sam Tavakoli [Thu, 8 Mar 2018 15:33:24 +0000 (15:33 +0000)] 
Add missing option for copy strings

Without this, call to decode with copy_strings option in an
application will make Dialyzer complain when using the exported type for options

4 years agoThis is 0.15.0 0.15.0
Paul J. Davis [Fri, 5 Jan 2018 19:12:20 +0000 (13:12 -0600)] 
This is 0.15.0

4 years agofixed issue 162 regarding duplicate keys in objects
Lynn Gabbay [Fri, 5 Jan 2018 17:51:24 +0000 (01:51 +0800)] 
fixed issue 162 regarding duplicate keys in objects

4 years agoAdd `copy_strings` feature
Paul J. Davis [Wed, 1 Nov 2017 19:18:15 +0000 (14:18 -0500)] 
Add `copy_strings` feature

Some users of Jiffy have experienced issues when decoding large JSON
documents. Normally Jiffy expects smallish documents and returns any
strings as sub-binaries. When dealing with large documents these
sub-binary references can keep a large amount of RAM around unless the
user goes through and applies `binary:copy/1` on every string returned
from Jiffy. This however causes a large amount of CPU usage to do
something that Jiffy could do as it builds the JSON structure.

The `copy_strings` decoder option does exactly this. Instead of
returning sub-binaries Jiffy now copies every string into a newly
allocated binary. Users report that this fixes the memory issues while
also not negatively affecting performance significantly.

4 years agoMerge remote-tracking branch 'davisp/master' CouchDB-0.14.13-1
Paul J. Davis [Wed, 1 Nov 2017 19:31:06 +0000 (14:31 -0500)] 
Merge remote-tracking branch 'davisp/master'

4 years agoBump to 0.14.13 0.14.13
Paul J. Davis [Wed, 1 Nov 2017 19:30:09 +0000 (14:30 -0500)] 
Bump to 0.14.13

4 years agoFix type spec
Paul J. Davis [Wed, 1 Nov 2017 19:29:37 +0000 (14:29 -0500)] 
Fix type spec

4 years agoBump to 0.14.12 0.14.12
Paul J. Davis [Tue, 31 Oct 2017 17:11:18 +0000 (12:11 -0500)] 
Bump to 0.14.12

4 years agoAdd tests for deduplication in child objects
Paul J. Davis [Tue, 31 Oct 2017 17:10:49 +0000 (12:10 -0500)] 
Add tests for deduplication in child objects

4 years agoDocument dedupe_keys option
Paul J. Davis [Tue, 31 Oct 2017 17:09:56 +0000 (12:09 -0500)] 
Document dedupe_keys option

4 years agoMerge remote-tracking branch 'davisp/master' CouchDB-0.14.11-2
Paul J. Davis [Mon, 30 Oct 2017 21:40:55 +0000 (16:40 -0500)] 
Merge remote-tracking branch 'davisp/master'

4 years agoAdd `dedupe_keys` option
Paul J. Davis [Mon, 30 Oct 2017 19:01:53 +0000 (14:01 -0500)] 
Add `dedupe_keys` option

You can no optionally request that keys are deduplicate inside of Jiffy
instead of having to perform that operation in Erlang.

4 years agoTighten string buffer size calculation in enc_string.
David Hull [Thu, 5 Oct 2017 20:48:56 +0000 (20:48 +0000)] 
Tighten string buffer size calculation in enc_string.

When "\u"-escaping a Unicode character, the esc_extra value doesn't
need to include the number of bytes in the input string.  That is, if
a three-byte UTF-8 character is being escaped to a six-byte "\uXXXX"
sequence, esc_extra only needs to be increased by 3.

4 years agotest erlang 20
getong [Tue, 29 Aug 2017 10:01:58 +0000 (18:01 +0800)] 
test erlang 20

4 years agoMerge remote-tracking branch 'davisp/master' CouchDB-0.14.11-1
Paul J. Davis [Thu, 6 Jul 2017 22:35:24 +0000 (17:35 -0500)] 
Merge remote-tracking branch 'davisp/master'

4 years agoMerge pull request #151 from wohali/win32-cleanup
Paul J. Davis [Thu, 6 Jul 2017 22:33:44 +0000 (17:33 -0500)] 
Merge pull request #151 from wohali/win32-cleanup

Cleanup after new enc lands

4 years agoMerge remote-tracking branch 'davisp/master'
Paul J. Davis [Thu, 6 Jul 2017 22:31:13 +0000 (17:31 -0500)] 
Merge remote-tracking branch 'davisp/master'

4 years agoUpdate enc for Windows support
Paul J. Davis [Thu, 6 Jul 2017 22:26:17 +0000 (17:26 -0500)] 
Update enc for Windows support

4 years agoCleanup after new enc lands
Joan Touzet [Thu, 6 Jul 2017 21:05:55 +0000 (17:05 -0400)] 
Cleanup after new enc lands

5 years agoMerge remote-tracking branch 'davisp/master'
Paul J. Davis [Wed, 7 Jun 2017 16:00:57 +0000 (11:00 -0500)] 
Merge remote-tracking branch 'davisp/master'

Update to latest Jiffy

5 years agoReplace old test case with generated data
Paul J. Davis [Wed, 7 Jun 2017 15:54:35 +0000 (10:54 -0500)] 
Replace old test case with generated data

For some reason I left a 377KiB test case checked in. Replacing this
with a generated test case is obvious in hindsight.

5 years agoSpecify the escript executable for hooks
Paul J. Davis [Fri, 17 Mar 2017 20:34:32 +0000 (15:34 -0500)] 
Specify the escript executable for hooks

Windows appears to not enjoy relative path names for exectuables so
hopefully this fixes things there.

Fixes #83

5 years agoJiffy 0.14.11 0.14.11
Paul J. Davis [Sat, 31 Dec 2016 02:59:49 +0000 (20:59 -0600)] 
Jiffy 0.14.11

5 years agoMaintain my own file list for hex
Paul J. Davis [Sat, 31 Dec 2016 02:57:25 +0000 (20:57 -0600)] 
Maintain my own file list for hex

Apparently hex only includes some files by default but not others
rather than a sane default of anything except for VCS directories. So
now I also get to maintain a list of files in my .app.src.

5 years agoBump to 0.14.10 because rebar3 is inept 0.14.10
Paul J. Davis [Thu, 29 Dec 2016 18:46:54 +0000 (12:46 -0600)] 
Bump to 0.14.10 because rebar3 is inept

Apparently rebar3 can't generate a sane version number from Git tags and
adds a bunch of BS build number and ref tags which hex.pm then rejects.
Given that I can't find any documentation on how that works and reading
code is an exercise in over engineered abstractionism I've succumbed to
the demoralizing conclusion that I'll just have to go back to the dark
ages and maintain my versions both in source and in version control.

5 years agoAdd `use_nil` to `encode_option` 0.14.9
Dan Swain [Thu, 19 May 2016 22:44:53 +0000 (18:44 -0400)] 
Add `use_nil` to `encode_option`

A call to `jiffy:encode(Term, [use_nil]).` will currently cause dialyzer
to issue a warning because `use_nil` is not included in `encode_option`.
This appears to just be an omission.

5 years agoMerge pull request #118 from davisp/feature-add-rebar3-support
Paul J. Davis [Mon, 10 Oct 2016 16:53:57 +0000 (11:53 -0500)] 
Merge pull request #118 from davisp/feature-add-rebar3-support

Add support for rebar3

5 years agoAdd support for rebar3
Paul J. Davis [Fri, 18 Mar 2016 20:48:20 +0000 (15:48 -0500)] 
Add support for rebar3

Allow Jiffy to be used easily in projects using either rebar 2 or 3.

5 years agoUpdate the list of Erlang VMs to use on Travis-CI
Paul J. Davis [Fri, 23 Sep 2016 20:35:20 +0000 (15:35 -0500)] 
Update the list of Erlang VMs to use on Travis-CI

5 years agoReplace PropEr with EQC
Paul J. Davis [Fri, 23 Sep 2016 20:19:19 +0000 (15:19 -0500)] 
Replace PropEr with EQC

PropEr broke my support for R14. Turns out that EQC Mini is quite usable
so I've just switched to that. If EQC Mini exists it will be used, if
not the test is skipped gracefully.

5 years agoMerge branch 'upstream'
Paul J. Davis [Thu, 14 Jul 2016 20:41:24 +0000 (15:41 -0500)] 
Merge branch 'upstream'

5 years agoFix enc_long for 64-bit Windows
Paul J. Davis [Wed, 13 Jul 2016 19:46:22 +0000 (14:46 -0500)] 
Fix enc_long for 64-bit Windows

Originally reported by @NorthNick on apache/couchdb-jiffy.

6 years agoMerge pull request #119 from egobrain/patch-1
Paul J. Davis [Wed, 6 Apr 2016 15:08:49 +0000 (10:08 -0500)] 
Merge pull request #119 from egobrain/patch-1

Fixed wrong jiffy:decode/2 spec

6 years agoFixed wrong jiffy:decode/2 spec
Yakov [Wed, 6 Apr 2016 10:22:01 +0000 (14:22 +0400)] 
Fixed wrong jiffy:decode/2 spec

6 years agoFix force_utf8 for object keys 0.14.8
Paul J. Davis [Thu, 31 Mar 2016 16:00:10 +0000 (11:00 -0500)] 
Fix force_utf8 for object keys

Previously if a key was malformed UTF-8 and the user specified the
`force_utf8` option we would fail to try and encode a fixed up version
of the object. This was due to missing a clause to catch the
`invalid_object_member_key` exception. This adds the clause and a couple
tests to ensure it works.

6 years agoCopy double-conversion license to root LICENSE 0.14.7
Paul J. Davis [Wed, 6 Jan 2016 19:28:05 +0000 (13:28 -0600)] 
Copy double-conversion license to root LICENSE

This was marked in the c_src/double-conversion directory but I've gone
ahead and added a copy to the root LICENSE file.

6 years agoIgnore hexer.config 0.14.6
Paul J. Davis [Wed, 6 Jan 2016 19:07:47 +0000 (13:07 -0600)] 
Ignore hexer.config

6 years agoUpdate jiff.app.src for hex.pm
Paul J. Davis [Wed, 6 Jan 2016 19:03:05 +0000 (13:03 -0600)] 
Update jiff.app.src for hex.pm

Time for Jiffy to enter the world of Erlang package management.

6 years agoRemove ETAP license information
Paul J. Davis [Wed, 6 Jan 2016 18:59:08 +0000 (12:59 -0600)] 
Remove ETAP license information

6 years agoDocument the use_nil option for encoding JSON
Paul J. Davis [Wed, 2 Dec 2015 17:29:36 +0000 (11:29 -0600)] 
Document the use_nil option for encoding JSON

6 years agoRemove old debug printing 0.14.5
Paul J. Davis [Wed, 2 Dec 2015 17:23:30 +0000 (11:23 -0600)] 
Remove old debug printing

6 years agoMerge pull request #113 from jparise/map-iter-destroy
Paul J. Davis [Wed, 2 Dec 2015 17:21:32 +0000 (11:21 -0600)] 
Merge pull request #113 from jparise/map-iter-destroy

Destroy map iterators once we're done with them.

6 years agoDestroy map iterators once we're done with them.
Jon Parise [Wed, 25 Nov 2015 22:58:00 +0000 (17:58 -0500)] 
Destroy map iterators once we're done with them.

Each call to enif_map_iterator_create() must be paired with a call to
enif_map_iterator_destroy(). Otherwise, we'll leak memory.

Fixes #112

6 years agoFix jiffy:encode Dialyzer spec. 0.14.4
Adam Krupicka [Tue, 13 Oct 2015 12:54:39 +0000 (14:54 +0200)] 
Fix jiffy:encode Dialyzer spec.

6 years agoMerge pull request #104 from pinotree/hurd
Paul J. Davis [Mon, 31 Aug 2015 16:51:10 +0000 (11:51 -0500)] 
Merge pull request #104 from pinotree/hurd

rebar.config: set CFLAGS/CXXFLAGS/LDFLAGS on Hurd

6 years agoDon't rely on an environment variable for Travis 0.14.3
Paul J. Davis [Mon, 31 Aug 2015 16:31:28 +0000 (11:31 -0500)] 
Don't rely on an environment variable for Travis

The environment variable approach breaks other projects' Travis-CI runs
if they include other projects that depend on a different version of
PropEr.

Fixes: #106

6 years agoReduce C++ flags to -O2 to fix gcc5 build
Joan Touzet [Thu, 27 Aug 2015 18:25:54 +0000 (14:25 -0400)] 
Reduce C++ flags to -O2 to fix gcc5 build

6 years agofix Windows compile options
Joan Touzet [Thu, 27 Aug 2015 17:53:43 +0000 (13:53 -0400)] 
fix Windows compile options

6 years agorebar.config: set CFLAGS/CXXFLAGS/LDFLAGS on Hurd
Pino Toscano [Mon, 24 Aug 2015 21:08:13 +0000 (23:08 +0200)] 
rebar.config: set CFLAGS/CXXFLAGS/LDFLAGS on Hurd

Use the common CFLAGS/CXXFLAGS/LDFLAGS used on Linux/FreeBSD/etc also
on GNU/Hurd.

6 years agoMerge pull request #103 from vicglarson/master
Paul J. Davis [Fri, 21 Aug 2015 20:04:35 +0000 (15:04 -0500)] 
Merge pull request #103 from vicglarson/master

Fix win32 build

6 years agoFix win32 build
Victor Galkin [Thu, 20 Aug 2015 11:59:58 +0000 (14:59 +0300)] 
Fix win32 build

6 years agoMerge branch 'upstream-merge'
Alexander Shorin [Tue, 28 Jul 2015 22:41:56 +0000 (01:41 +0300)] 
Merge branch 'upstream-merge'

6 years agoFix compiler warning on gcc 5.1.0 0.14.2
Paul J. Davis [Sat, 25 Jul 2015 17:47:52 +0000 (12:47 -0500)] 
Fix compiler warning on gcc 5.1.0

6 years agoRemove travis notification 2/head
Alexander Shorin [Sat, 25 Jul 2015 12:51:07 +0000 (15:51 +0300)] 
Remove travis notification

6 years agoRemove related path to rebar
Alexander Shorin [Sat, 25 Jul 2015 12:50:47 +0000 (15:50 +0300)] 
Remove related path to rebar

6 years agoMerge branch 'upstream' into upstream-merge
Alexander Shorin [Sat, 25 Jul 2015 12:50:15 +0000 (15:50 +0300)] 
Merge branch 'upstream' into upstream-merge

6 years agoAdd latest Erlang VMs to the test matrix upstream 0.14.1
Paul J. Davis [Fri, 17 Jul 2015 17:31:11 +0000 (12:31 -0500)] 
Add latest Erlang VMs to the test matrix

6 years agoRemove flaky test case
Paul J. Davis [Fri, 17 Jul 2015 17:18:21 +0000 (12:18 -0500)] 
Remove flaky test case

This test has proved its point and now just exists to randomly fail some
builds depending on race conditions with the garbage collector.

6 years agoFix map type spec
Paul J. Davis [Fri, 17 Jul 2015 17:16:48 +0000 (12:16 -0500)] 
Fix map type spec

I was being lazy and relying on Travis. This fixes up the map spec for
newer VMs.

6 years agoAdd map typespec for dialyzer
Paul J. Davis [Fri, 17 Jul 2015 16:59:50 +0000 (11:59 -0500)] 
Add map typespec for dialyzer

This obviously only exists on VMs that support it.

6 years agoStrings can be atoms or binaries
Paul J. Davis [Fri, 17 Jul 2015 16:59:39 +0000 (11:59 -0500)] 
Strings can be atoms or binaries

6 years agoFix dialyzer type specs 0.14.0
Paul J. Davis [Wed, 15 Jul 2015 23:43:06 +0000 (18:43 -0500)] 
Fix dialyzer type specs

6 years agoRevamp yields back to Erlang
Paul J. Davis [Wed, 15 Jul 2015 22:00:42 +0000 (17:00 -0500)] 
Revamp yields back to Erlang

In the original PR for `return_trailer` @vlm pointed out that I wasn't
using enif_consume_timeslice correctly. This fixes that by changing out
its called.

Previously we attempted to define the total number of bytes to decode or
encode in a single NIF call and then would consume as much of the
timeslice as we processed. This is wrong because we may start the NIF
call with less than an entire timeslice left.

The new approach is to define the number of bytes to encode or decode
per reduction and then iteratively call enif_consume_timeslice until it
indicates that we should return.

6 years agoAdd new return_trailer option
Paul J. Davis [Wed, 15 Jul 2015 21:18:13 +0000 (16:18 -0500)] 
Add new return_trailer option

Previously Jiffy would throw an error about trailing data if there is
any non-whitespace character encounter after the first term had been
decoded.

This patch adds a decoder option `return_trailer` that will instead
return a sub-binary starting at the first non-whitespace character. This
allows users to be able to decode multiple terms from a single iodata()
term.

Thanks to @vlm for the original patch.