243 Commits

Author SHA1 Message Date
Milo Yip
ca5000ba67 Merge pull request #108 from miloyip/ParsingOptimization
Parsing optimization
2014-08-21 12:53:17 +08:00
miloyip
4f81c873a6 Optimize SkipWhitespace_SIMD()
Do unaligned non-SIMD matching first, and then SIMD matching later.
Also add a fast path for no skipping.
2014-08-20 17:49:30 +08:00
miloyip
fdc2b569db Optimize number parsing for 64-bit architecture 2014-08-20 15:17:21 +08:00
Philipp A. Hartmann
744b4852ff GenericValue: add (optional) support for std::string
Some users may want to use RapidJSON with std::string objects.  This commits
adds an (opt-in) feature to include some basic support.  The implementation
uses std::basic_string<Ch> as generic string type.

Support currently covers:
 * construction
 * comparison

No special APIs for AddMember or PushBack have been added, as std::string
most probably requires copying (or an explicit StringRef() call).
2014-08-20 07:07:55 +02:00
Philipp A. Hartmann
702b45bb6e GenericValue: refactoring of operator==/!=
By restructuring the call forwarding of the various operator== and
operator!= overloads, new overloads can be added by simply adding an
additional member operator==.

Additionally, the "Ch*" overloads are dropped in favour of an SFINAE
version that removes the pointer variants from matching the templated
operator== (see also operator=).
2014-08-20 07:07:42 +02:00
Philipp A. Hartmann
1621ba3a41 add Doxygen documentation for error handling customization 2014-08-19 19:13:01 +02:00
Philipp A. Hartmann
abcd6df2c0 add Doxygen documentation for configuration macros 2014-08-19 19:12:45 +02:00
Milo Yip
c0a7922db0 Merge pull request #105 from miloyip/MemoryOptimization
Memory optimization
2014-08-19 00:07:49 +08:00
Milo Yip
e3aa8f427c Remove unused macro 2014-08-17 20:55:49 +08:00
Milo Yip
941aa93f45 Separate Document's value and stack allocator.
Use CrtAllocator for stack.
ShrinkToFit stack after parsing.
2014-08-17 18:33:47 +08:00
Milo Yip
3714019819 Add ShrinkToFit() to StringBuffer and MemoryBuffer 2014-08-17 18:32:08 +08:00
Milo Yip
2e23787753 Change Reader/Writer's stack allocator to CrtAllocator 2014-08-17 18:31:41 +08:00
Milo Yip
4a2ddf8075 Add Stack::ShrinkToFit() and some refactoring.
Lazy allocation. (so Document not for parsing don't need to allocate
stack).
Remove redundant stackCapacity member variable.
2014-08-17 18:29:37 +08:00
miloyip
126e62ed25 Fix #104 ParseNumberHandler fails on 32-bit
Use a tighter bound.
2014-08-13 14:16:29 +08:00
Philipp A. Hartmann
453eda5f94 tabs to 4 spaces (following 0dbcc1cf) 2014-08-11 17:22:11 +02:00
Philipp A. Hartmann
3755470f0f BaseReaderHandler: allow overriding of Default() implementation
By adding an optional CRTP template parameter, the BaseReaderHandler
can call the "overridden" `Default()` function from the `Derived`
class.

See https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
2014-08-11 17:15:07 +02:00
Philipp A. Hartmann
89793599ce error/{en,error}.h: drop unused kParseErrorDocumentRootNotObjectOrArray error 2014-08-11 17:14:31 +02:00
Philipp A. Hartmann
c9f2715115 Reader: drop object/array root restrction from iterative parser 2014-08-11 17:14:31 +02:00
Philipp A. Hartmann
edccda00bd drop object/array root restriction from recursive parser 2014-08-11 17:14:31 +02:00
Philipp A. Hartmann
8d53689432 (Pretty)Writer: drop restriction to object/array roots 2014-08-11 17:14:31 +02:00
Milo Yip
0dbcc1cf2e Add license and change indents from tab to space. 2014-08-11 22:26:45 +08:00
Milo Yip
c54915297b Change CountDecimalDigit32() to simple implementation
It is simple and pure C++. And it is found in performance test that it
is even faster than the original version, due to distribution of n. But
the performance gain is not obvious in RapidJSON.
2014-08-11 00:30:31 +08:00
Milo Yip
1900b7bace Remove double precision settings API in Writer 2014-08-09 21:37:02 +08:00
Milo Yip
0d915644a4 Fixed gcc effc++ warning in dtoa.h 2014-08-09 21:27:32 +08:00
Milo Yip
a7762a3453 Custom dtoa() impleemntation
Modified from Milo's Grisu2 implementation. 99.9% cases return shortest
decimal format.
2014-08-09 21:12:58 +08:00
Milo Yip
6978778884 Change double parsing with fast-path conversion
Accurate rounding in normal numerical ranges, also reduce lookup table
size.
2014-08-09 21:11:37 +08:00
Milo Yip
0e4f08ea89 Fix a compilation error due to INT64_C 2014-08-08 22:07:02 +08:00
Milo Yip
5e5fb7b3d8 Change UINT64_C() to RAPIDJSON_UINT64_C2()
Fix #94
2014-08-08 21:34:43 +08:00
Milo Yip
41dde39bbc Merge pull request #96 from miloyip/issue91removeelement
Fix #91
2014-08-08 20:42:55 +08:00
Milo Yip
2f9544620b Add UINT64_C() macros for 64-bit integer literals in u64toa() 2014-08-01 00:25:56 +08:00
Milo Yip
c3ad232c3e Fixes size type in Value::operator==() 2014-08-01 00:01:06 +08:00
Milo Yip
9892847021 Update documents about erase member/elements, also added some time complexity information. 2014-07-31 23:58:52 +08:00
Milo Yip
10098319fe Merge pull request #92 from pah/issue91removeelement
Remove for object members, some cleanups for values
2014-07-31 19:19:44 +08:00
Philipp A. Hartmann
fc6d7a59dc GenericValue: rename Erase(ConstMemberIterator) to EraseMember 2014-07-31 13:16:56 +02:00
miloyip
afe59a0db1 Makes StringEqual() more safe by always compares lengths. 2014-07-31 19:08:37 +08:00
Philipp A. Hartmann
96af95c945 GenericValue: add Erase function for object members 2014-07-31 13:03:32 +02:00
Philipp A. Hartmann
c0fcdcc478 GenericValue: use generated assignment/destructor for GenericMember 2014-07-31 13:03:32 +02:00
Philipp A. Hartmann
59fee54f9d GenericValue::Erase: pass ConstValueIterators 2014-07-31 13:03:32 +02:00
Philipp A. Hartmann
9a9c6d6810 GenericValue: improve Erase documentation 2014-07-31 13:03:32 +02:00
Philipp A. Hartmann
6ed9934143 GenericValue: document Array iterator functions 2014-07-31 13:03:32 +02:00
Philipp A. Hartmann
11d31aaa7b fix typo 2014-07-31 13:03:32 +02:00
miloyip
71ae5660ed Revert "Add Erase(ConstValueIterator) and Erase(ConstValueIterator,ConstValueIterator)"
This reverts commit 9ab2621e855a9abb8377520b42d6dfddcd49a8e1.
2014-07-31 18:56:57 +08:00
miloyip
9ab2621e85 Add Erase(ConstValueIterator) and Erase(ConstValueIterator,ConstValueIterator)
As std::vector::erase() overloads added in C++11
2014-07-31 18:53:17 +08:00
miloyip
71c8402549 Add equal-to and non-equal-to operators 2014-07-31 18:43:59 +08:00
miloyip
0f7d2dad51 Add 2 overloads of Erase() for removing elements of array. 2014-07-31 14:22:59 +08:00
Milo Yip
808d362b88 Fix parsing numbers which are less than 1e-308
Overflow should check sign of exponent.
2014-07-30 23:27:17 +08:00
miloyip
a32e2ac1d0 Fix SIMD page fault by using aligned load 2014-07-29 16:05:54 +08:00
Milo Yip
e6f344637b Merge pull request #83 from miloyip/issue75stopwhendone
Issue75stopwhendone
2014-07-28 18:45:06 +08:00
Milo Yip
c545895368 Merge pull request #84 from miloyip/issue79memorystreambuffer
Add MemoryBuffer and MemoryStream
2014-07-28 18:45:00 +08:00
Milo Yip
b60bcc2762 Add MemoryBuffer and MemoryStream 2014-07-27 19:29:57 +08:00