Inderjeet Singh
fd4fbe4132
Added support for collections, maps, and arbitrary depth of type adapters for Intercept annotation.
...
Added more tests for the features.
2012-10-18 02:37:43 +00:00
Inderjeet Singh
714ac8e643
added tests for using intercept in fields and lists. These tests are currently failing.
2012-10-11 20:29:40 +00:00
Inderjeet Singh
c25278b4d6
Created an alpha package that holds experimental feature.
...
Added support for JsonPostDeserializer that allows you to invoke postDeserialize methods on an Gson deserialized object.
2012-10-11 03:20:36 +00:00
Joel Leitch
14f16e2d0c
Adding Red-Black Tree implementation and tying it into the Gson bindings.
2012-10-11 03:15:49 +00:00
Jesse Wilson
c950d28460
Followup to r1175. Use the same copyright holder for all files.
2012-09-30 17:19:12 +00:00
Jesse Wilson
2fef83799d
Optimizations and bug fixes for LinkedHashTreeMap.
...
The most interesting optimization is to replace ArrayDeque with a manual linked list that reuses the nodes 'parent' field. These optimizations save about 20%.
2012-09-17 03:30:20 +00:00
Jesse Wilson
aceadaecf1
Add a hashing layer to LinkedTreeMap. Instead of having 1 root node, the class now has several root nodes, one for each hash bucket in a hash table.
...
Compared to LinkedTreeMap, this is slower for small (size=5) maps: 124% slower to get() and 33% slower to create and populate. It's a win for large (size=500) maps: 46% faster to get() but 8% slower to create and populate. And it's a big win for very large (size=50,000) maps: 81% faster to get() and 46% faster to create and populate.
http://microbenchmarks.appspot.com/run/limpbizkit@gmail.com/com.google.common.collect.MapBenchmark
I'm going to follow this up with some simple optimizations: caching local fields and simplifying access. That should narrow the performance gap.
2012-09-17 00:19:44 +00:00
Jesse Wilson
a0493b9732
New code that can split an AVL tree into two AVL trees.
...
This is in preparation for a new feature where LinkedTreeMap will have multiple roots, each in its own hash bucket.
2012-09-15 06:13:33 +00:00
Jesse Wilson
01bd0d92e2
Tests for LinkedTreeMap with incompatible keys.
2012-09-12 05:06:48 +00:00
Jesse Wilson
a6ab854302
Fix a bug where we were unlinking nodes that shouldn't have been unlinked.
...
Found by Guava's awesome collections test suite!
2012-09-12 04:41:58 +00:00
Jesse Wilson
93e38901df
Draft of LinkedTreeMap. Its ordered like a LinkedHashMap but it doesn't do any hashing for DoS resistance.
...
Not yet adopted in our code.
Known critical bugs:
- throws ClassCastException when get() is called with a non-comparable key
- throws NullPointerException on get(null)
2012-09-10 20:04:38 +00:00
Jesse Wilson
084047d80b
Reintroduce string pooling in JsonReader.
...
This makes Hotspot slower. From my before/after measurements using ParseBenchmark, times in microseconds:
TWEETS: 350 -> 370 (+6%)
READER_SHORT: 77 -> 76 (-1%)
READER_LONG: 870 -> 940 (+8%)
But it makes Dalvik faster by a greater margin. These before/after measurements use times in milliseconds:
TWEETS: 25 -> 20 (-20%)
READER_SHORT: 5.6 -> 4.7 (-16%)
READER_LONG: 52 -> 47 (-10%)
It's a net win because we're saving a greater fraction of time, and because we're helping the platform that needs the most help. We're paying microseconds on Hotspot to gain milliseconds on Dalvik.
2012-09-10 16:13:33 +00:00
Inderjeet Singh
680bd75a85
moved code from gson/gson-codegen to top-level
2012-09-04 21:21:46 +00:00
Inderjeet Singh
d1ff7bb397
Deleted spurious directory gson-codegen. The real codegen code is in trunk/codegen
2012-09-04 21:10:12 +00:00
Jesse Wilson
411c5c0b50
Follow up on r1197 and make deepCopy package-private. We don't want to use protected because some of the classes are non-final and protected shows up in the Javadocs.
2012-09-03 23:30:27 +00:00
Inderjeet Singh
a973837dd4
made deepCopy protected to eliminate it from the public API for now.
...
It will be in the subsequent release.
2012-09-03 08:34:37 +00:00
Jesse Wilson
8df7209074
Fix cut & paste issue in JsonToken Javadocs.
...
Fixes issue 463.
2012-09-02 21:29:30 +00:00
Jesse Wilson
b3b919770b
Change number parsing to use one big loop. This changes it to return JsonToken.STRING for very long (>8k digits) numbers.
2012-09-02 20:12:19 +00:00
Jesse Wilson
3920d95fac
rename peekedInteger to peekedLong
2012-09-02 17:46:02 +00:00
Jesse Wilson
8daf3aaeb4
Inline position computation. This is uglier but faster.
2012-08-28 03:52:18 +00:00
Jesse Wilson
46b73632b0
Fix a bug where we weren't reading enough characters when a BOM was encountered.
2012-08-28 01:48:25 +00:00
Jesse Wilson
980796005f
Use a conventional for loop in nextQuotedValue() to make hotspot's job easier.
2012-08-27 04:42:39 +00:00
Jesse Wilson
bdf2cac6d4
Replace switch with if/else when processing whitespace. If/else is faster!
2012-08-27 04:17:29 +00:00
Jesse Wilson
b0a172944a
More number parsing improvements.
2012-08-27 03:17:41 +00:00
Jesse Wilson
448063dde1
Fix a goof in number parsing.
2012-08-27 03:07:20 +00:00
Jesse Wilson
4c2980e6ff
Fix a bug in integer parsing.
2012-08-27 02:34:52 +00:00
Jesse Wilson
c7cb503cdb
Restore fast skips.
...
document api ns linear runtime
TWEETS GSON_STREAM 397568 =========
TWEETS GSON_SKIP 300058 =======
READER_SHORT GSON_STREAM 76632 =
READER_SHORT GSON_SKIP 57796 =
READER_LONG GSON_STREAM 894690 =====================
READER_LONG GSON_SKIP 565114 =============
2012-08-27 01:17:50 +00:00
Jesse Wilson
085856c128
Don't leave the JsonReader in an invalid state if nextInt(), nextDouble() or nextLong() fails. We now save a reference to the string before we parse it, and keep that referenced value if parsing fails.
2012-08-26 22:06:57 +00:00
Jesse Wilson
e7bfd0c97d
Promote JsonReader2 to be the main JsonReader implementation.
2012-08-26 19:34:46 +00:00
Jesse Wilson
553fa6b742
Prepare to replace JsonReader with JsonReader2
2012-08-26 19:33:49 +00:00
Jesse Wilson
b96d2d9837
Support non-execute prefixes.
2012-08-26 19:31:06 +00:00
Jesse Wilson
97cb326ad2
Delete an old version of the rewritten JsonReader
2012-08-26 04:04:22 +00:00
Jesse Wilson
46b4346505
Get JsonReader2 to the point that it's passing most tests.
...
Still missing:
- non-execute prefixes
- rolling back 'pos' when a double fails to parse
- octal prefix failures
2012-08-26 04:02:09 +00:00
Jesse Wilson
c5c65ba626
Add an experimental rewrite of JsonReader.
...
The motivating difference is that JsonReaderV2 tries to read each character at most once. This means that when it reads literals, it also attempts to decode them to a keyword (true/false/null) or a number.
This change also _doesn't_ read strings until demanded to do so. This should permit streaming access to strings down the road.
This code is not yet complete, nor is has it been properly optimized. And the implementation is also quite a mess! It is a work in progress.
2012-08-25 04:31:56 +00:00
Jesse Wilson
9c4b23b39a
JsonObject.deepCopy() for Gson.
2012-08-21 01:19:43 +00:00
Jesse Wilson
1a4f690335
Regretfully enable serialization for StringMap and LazilyParsedNumber.
...
One of our favorite users (my employer!) is stuck in a sad situation where they need to serialize objects returned from Gson; this is a workable escape hatch.
2012-08-15 14:58:26 +00:00
Jesse Wilson
35c13173b0
Switch on ints rather than enums in JsonReader.
...
Using enums was triggering this Android bug:
http://code.google.com/p/android/issues/detail?id=36349
2012-08-14 21:32:18 +00:00
Inderjeet Singh
7d901d34fb
Beginning of a simple test related to codegen.
2012-08-02 01:35:45 +00:00
Jesse Wilson
3be354eb76
APT hello world. This generates an empty class for each class annotated @GeneratedTypeAdapter.
2012-08-01 22:58:04 +00:00
Inderjeet Singh
8cc703ed21
Added Gson dependency
2012-08-01 22:09:59 +00:00
Inderjeet Singh
6aad250f47
Initial creation of the codegen project
2012-08-01 22:06:29 +00:00
Inderjeet Singh
42e35e9f90
updated oss-parent version to 7 in gson-extras pom.
...
fixed some eclipse warnings.
2012-08-01 20:57:51 +00:00
Inderjeet Singh
982c893d65
updated extras pom to latest plugin versions.
...
updated organization names for Jesse and Inder.
2012-08-01 20:54:37 +00:00
Jesse Wilson
f406d3cf89
Don't fall back when we're already in the slow case.
2012-07-10 23:45:20 +00:00
Jesse Wilson
4aaa4bf20c
StringMap was suffering because the string's hashCode was not cached. Address this by preferring the regular String.hashCode until hash collision problems start to occur.
2012-07-10 18:46:01 +00:00
Inderjeet Singh
b36bedb423
Javadocs for 2.2.2
2012-07-03 01:09:24 +00:00
Inderjeet Singh
33de25f9fe
[maven-release-plugin] prepare for next development iteration
2012-07-03 00:44:56 +00:00
Inderjeet Singh
66cb689aae
[maven-release-plugin] prepare release gson-2.2.2
2012-07-03 00:44:47 +00:00
Inderjeet Singh
f412d7ede2
changed version to 2.2.2-SNAPSHOT
2012-07-03 00:31:00 +00:00
Inderjeet Singh
b946a229b6
deleted unused field.
2012-07-03 00:28:55 +00:00