jrjackson 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.jrubyrc +433 -0
- data/Gemfile +1 -1
- data/README.md +32 -23
- data/benchmarking/.jrubyrc +2 -2
- data/benchmarking/benchmark.rb +10 -58
- data/benchmarking/benchmark_threaded.rb +153 -0
- data/dependency-reduced-pom.xml +72 -0
- data/jrjackson.gemspec +11 -5
- data/lib/jrjackson/jars/jrjackson-1.2.2.jar +0 -0
- data/lib/jrjackson/jrjackson.rb +22 -18
- data/lib/jrjackson/version.rb +1 -2
- data/pom.xml +15 -10
- data/src/main/java/com/jrjackson/JrJacksonRaw.java +97 -12
- data/src/main/java/com/jrjackson/JrJacksonService.java +0 -6
- data/src/main/java/com/jrjackson/RubyJacksonModule.java +74 -0
- data/src/main/java/com/jrjackson/RubyObjectDeserializer.java +138 -222
- data/src/main/java/com/jrjackson/RubyObjectStrDeserializer.java +23 -0
- data/src/main/java/com/jrjackson/RubyObjectSymDeserializer.java +3 -60
- data/src/main/java/com/jrjackson/RubyUtils.java +77 -0
- data/src/test/java/com/jrjackson/jruby/AppTest.java +38 -0
- data/test/jrjackson_test.rb +63 -0
- metadata +17 -13
- data/lib/jrjackson/jars/jrjackson-1.0.jar +0 -0
- data/src/main/java/com/jrjackson/JrJacksonStr.java +0 -80
- data/src/main/java/com/jrjackson/JrJacksonSym.java +0 -80
data/.jrubyrc
ADDED
@@ -0,0 +1,433 @@
|
|
1
|
+
################################################################################
|
2
|
+
# compiler settings
|
3
|
+
################################################################################
|
4
|
+
|
5
|
+
# Set compilation mode. JIT = at runtime; FORCE = before execution.
|
6
|
+
# Options: [JIT, FORCE, OFF, OFFIR], Default: JIT.
|
7
|
+
# compile.mode=JIT
|
8
|
+
compile.mode=FORCE
|
9
|
+
|
10
|
+
# Dump to console all bytecode generated at runtime.
|
11
|
+
# Options: [true, false], Default: false.
|
12
|
+
compile.dump=false
|
13
|
+
|
14
|
+
# (EXPERIMENTAL) Turn on compilation without polling for "unsafe" thread events.
|
15
|
+
# Options: [true, false], Default: false.
|
16
|
+
compile.threadless=false
|
17
|
+
|
18
|
+
# Turn on fast operators for Fixnum and Float.
|
19
|
+
# Options: [true, false], Default: true.
|
20
|
+
compile.fastops=true
|
21
|
+
|
22
|
+
# Set the number of lines at which compiled bodies are "chained".
|
23
|
+
# Options: [Integer], Default: 500.
|
24
|
+
compile.chainsize=500
|
25
|
+
|
26
|
+
# Generate method bindings (handles) for compiled methods lazily.
|
27
|
+
# Options: [true, false], Default: false.
|
28
|
+
compile.lazyHandles=false
|
29
|
+
|
30
|
+
# Enable or disable peephole optimizations.
|
31
|
+
# Options: [true, false], Default: true.
|
32
|
+
compile.peephole=true
|
33
|
+
|
34
|
+
# Compile calls without guards, for experimentation.
|
35
|
+
# Options: [true, false], Default: false.
|
36
|
+
compile.noguards=false
|
37
|
+
|
38
|
+
# Compile with all "mostly harmless" compiler optimizations.
|
39
|
+
# Options: [true, false], Default: false.
|
40
|
+
compile.fastest=false
|
41
|
+
|
42
|
+
# Compile obj.__send__(<literal>, ...) as obj.<literal>(...).
|
43
|
+
# Options: [true, false], Default: false.
|
44
|
+
compile.fastsend=false
|
45
|
+
|
46
|
+
# Return true from multiple assignment instead of a new array.
|
47
|
+
# Options: [true, false], Default: false.
|
48
|
+
compile.fastMasgn=false
|
49
|
+
|
50
|
+
# Use invokedynamic for optimizing Ruby code
|
51
|
+
# Options: [true, false], Default: false.
|
52
|
+
# compile.invokedynamic=false
|
53
|
+
compile.invokedynamic=true
|
54
|
+
|
55
|
+
|
56
|
+
################################################################################
|
57
|
+
# invokedynamic settings
|
58
|
+
################################################################################
|
59
|
+
|
60
|
+
# Maximum call site failures after which to inline cache.
|
61
|
+
# Options: [Integer], Default: 1000.
|
62
|
+
invokedynamic.maxfail=1000
|
63
|
+
|
64
|
+
# Maximum polymorphism of PIC binding.
|
65
|
+
# Options: [Integer], Default: 2.
|
66
|
+
invokedynamic.maxpoly=2
|
67
|
+
|
68
|
+
# Log binding of invokedynamic call sites.
|
69
|
+
# Options: [true, false], Default: false.
|
70
|
+
invokedynamic.log.binding=false
|
71
|
+
|
72
|
+
# Log invokedynamic-based constant lookups.
|
73
|
+
# Options: [true, false], Default: false.
|
74
|
+
invokedynamic.log.constants=false
|
75
|
+
|
76
|
+
# Enable all possible uses of invokedynamic.
|
77
|
+
# Options: [true, false], Default: false.
|
78
|
+
invokedynamic.all=false
|
79
|
+
|
80
|
+
# Enable all safe (but maybe not fast) uses of invokedynamic.
|
81
|
+
# Options: [true, false], Default: false.
|
82
|
+
invokedynamic.safe=false
|
83
|
+
|
84
|
+
# Enable invokedynamic for method invocations.
|
85
|
+
# Options: [true, false], Default: true.
|
86
|
+
invokedynamic.invocation=true
|
87
|
+
|
88
|
+
# Use SwitchPoint for class modification guards on invocations.
|
89
|
+
# Options: [true, false], Default: true.
|
90
|
+
invokedynamic.invocation.switchpoint=true
|
91
|
+
|
92
|
+
# Also bind indirect method invokers to invokedynamic.
|
93
|
+
# Options: [true, false], Default: true.
|
94
|
+
invokedynamic.invocation.indirect=true
|
95
|
+
|
96
|
+
# Bind Ruby to Java invocations with invokedynamic.
|
97
|
+
# Options: [true, false], Default: true.
|
98
|
+
invokedynamic.invocation.java=true
|
99
|
+
|
100
|
+
# Bind Ruby attribue invocations directly to invokedynamic.
|
101
|
+
# Options: [true, false], Default: true.
|
102
|
+
invokedynamic.invocation.attr=true
|
103
|
+
|
104
|
+
# Bind Fixnum and Float math using optimized logic.
|
105
|
+
# Options: [true, false], Default: true.
|
106
|
+
invokedynamic.invocation.fastops=true
|
107
|
+
|
108
|
+
# Use invokedynamic to load cached values like literals and constants.
|
109
|
+
# Options: [true, false], Default: true.
|
110
|
+
invokedynamic.cache=true
|
111
|
+
|
112
|
+
# Use invokedynamic to load constants.
|
113
|
+
# Options: [true, false], Default: true.
|
114
|
+
invokedynamic.cache.constants=true
|
115
|
+
|
116
|
+
# Use invokedynamic to load literals.
|
117
|
+
# Options: [true, false], Default: true.
|
118
|
+
invokedynamic.cache.literals=true
|
119
|
+
|
120
|
+
# Use invokedynamic to get/set instance variables.
|
121
|
+
# Options: [true, false], Default: true.
|
122
|
+
invokedynamic.cache.ivars=true
|
123
|
+
|
124
|
+
# Use ClassValue to store class-specific data.
|
125
|
+
# Options: [true, false], Default: false.
|
126
|
+
invokedynamic.class.values=false
|
127
|
+
|
128
|
+
# ################################################################################
|
129
|
+
# # jit settings
|
130
|
+
# ################################################################################
|
131
|
+
|
132
|
+
# # Set the JIT threshold to the specified method invocation count.
|
133
|
+
# # Options: [Integer], Default: 50.
|
134
|
+
jit.threshold=1
|
135
|
+
|
136
|
+
# # Set the max count of active methods eligible for JIT-compilation.
|
137
|
+
# # Options: [Integer], Default: 4096.
|
138
|
+
jit.max=16384
|
139
|
+
|
140
|
+
# # Set the maximum full-class byte size allowed for jitted methods.
|
141
|
+
# # Options: [Integer], Default: 30000.
|
142
|
+
# jit.maxsize=30000
|
143
|
+
|
144
|
+
# # Enable JIT logging (reports successful compilation).
|
145
|
+
# # Options: [true, false], Default: false.
|
146
|
+
# jit.logging=false
|
147
|
+
|
148
|
+
# # Enable verbose JIT logging (reports failed compilation).
|
149
|
+
# # Options: [true, false], Default: false.
|
150
|
+
# jit.logging.verbose=false
|
151
|
+
|
152
|
+
# # Enable stdout dumping of JITed bytecode.
|
153
|
+
# # Options: [true, false], Default: false.
|
154
|
+
# jit.dumping=false
|
155
|
+
|
156
|
+
# # Log a message every n methods JIT compiled.
|
157
|
+
# # Options: [Integer], Default: 0.
|
158
|
+
# jit.logEvery=0
|
159
|
+
|
160
|
+
# # Exclude methods from JIT. Comma delimited.
|
161
|
+
# # Options: [ClsOrMod, ClsOrMod::method_name, -::method_name], Default: none.
|
162
|
+
# jit.exclude=none
|
163
|
+
|
164
|
+
# # Cache jitted method in-memory bodies across runtimes and loads.
|
165
|
+
# # Options: [true, false], Default: true.
|
166
|
+
# jit.cache=true
|
167
|
+
|
168
|
+
# # Save jitted methods to <dir> as they're compiled, for future runs.
|
169
|
+
# # Options: [dir], Default: null.
|
170
|
+
# jit.codeCache=null
|
171
|
+
|
172
|
+
# # Log loading of JITed bytecode.
|
173
|
+
# # Options: [true, false], Default: false.
|
174
|
+
# jit.debug=false
|
175
|
+
|
176
|
+
# # Run the JIT compiler in a background thread.
|
177
|
+
# # Options: [true, false], Default: true.
|
178
|
+
# jit.background=true
|
179
|
+
|
180
|
+
|
181
|
+
# ################################################################################
|
182
|
+
# # intermediate representation settings
|
183
|
+
# ################################################################################
|
184
|
+
|
185
|
+
# # Debug generation of JRuby IR.
|
186
|
+
# # Options: [true, false], Default: false.
|
187
|
+
# ir.debug=false
|
188
|
+
|
189
|
+
# # [EXPT]: Profile IR code during interpretation.
|
190
|
+
# # Options: [true, false], Default: false.
|
191
|
+
# ir.profile=false
|
192
|
+
|
193
|
+
# # Debug compilation of JRuby IR.
|
194
|
+
# # Options: [true, false], Default: false.
|
195
|
+
# ir.compiler.debug=false
|
196
|
+
|
197
|
+
# # Specify comma delimeted list of passes to run.
|
198
|
+
# # Options: [String], Default: null.
|
199
|
+
# ir.passes=null
|
200
|
+
|
201
|
+
# # Specify comma delimeted list of passes to run after inlining a method.
|
202
|
+
# # Options: [String], Default: null.
|
203
|
+
# ir.inline_passes=null
|
204
|
+
|
205
|
+
|
206
|
+
# ################################################################################
|
207
|
+
# # native settings
|
208
|
+
# ################################################################################
|
209
|
+
|
210
|
+
# # Enable/disable native code, including POSIX features and C exts.
|
211
|
+
# # Options: [true, false], Default: true.
|
212
|
+
# native.enabled=true
|
213
|
+
|
214
|
+
# # Enable verbose logging of native extension loading.
|
215
|
+
# # Options: [true, false], Default: false.
|
216
|
+
# native.verbose=false
|
217
|
+
|
218
|
+
# # Enable or disable C extension support.
|
219
|
+
# # Options: [true, false], Default: false.
|
220
|
+
# cext.enabled=false
|
221
|
+
|
222
|
+
# # Dump bytecode-generated FFI stubs to console.
|
223
|
+
# # Options: [true, false], Default: false.
|
224
|
+
# ffi.compile.dump=false
|
225
|
+
|
226
|
+
# # Number of FFI invocations before generating a bytecode stub.
|
227
|
+
# # Options: [Integer], Default: 100.
|
228
|
+
# ffi.compile.threshold=100
|
229
|
+
|
230
|
+
# # Use invokedynamic to bind FFI invocations.
|
231
|
+
# # Options: [true, false], Default: false.
|
232
|
+
# ffi.compile.invokedynamic=false
|
233
|
+
|
234
|
+
|
235
|
+
# ################################################################################
|
236
|
+
# # thread pooling settings
|
237
|
+
# ################################################################################
|
238
|
+
|
239
|
+
# # Enable reuse of native threads via a thread pool.
|
240
|
+
# # Options: [true, false], Default: false.
|
241
|
+
# thread.pool.enabled=false
|
242
|
+
|
243
|
+
# # The minimum number of threads to keep alive in the pool.
|
244
|
+
# # Options: [Integer], Default: 0.
|
245
|
+
# thread.pool.min=0
|
246
|
+
|
247
|
+
# # The maximum number of threads to allow in the pool.
|
248
|
+
# # Options: [Integer], Default: 2147483647.
|
249
|
+
# thread.pool.max=2147483647
|
250
|
+
|
251
|
+
# # The maximum number of seconds to keep alive an idle thread.
|
252
|
+
# # Options: [Integer], Default: 60.
|
253
|
+
# thread.pool.ttl=60
|
254
|
+
|
255
|
+
|
256
|
+
################################################################################
|
257
|
+
# miscellaneous settings
|
258
|
+
################################################################################
|
259
|
+
|
260
|
+
# Specify the major Ruby version to be compatible with.
|
261
|
+
# Options: [1.8, 1.9, 2.0], Default: 1.9.
|
262
|
+
compat.version=1.9
|
263
|
+
|
264
|
+
# Enable or disable ObjectSpace.each_object.
|
265
|
+
# Options: [true, false], Default: false.
|
266
|
+
objectspace.enabled=false
|
267
|
+
|
268
|
+
# Enable or disable SipHash for String hash function.
|
269
|
+
# Options: [true, false], Default: false.
|
270
|
+
siphash.enabled=false
|
271
|
+
|
272
|
+
# Set in-process launching of e.g. system('ruby ...').
|
273
|
+
# Options: [true, false], Default: false.
|
274
|
+
launch.inproc=false
|
275
|
+
|
276
|
+
# Specify the major Java bytecode version.
|
277
|
+
# Options: [1.5, 1.6, 1.7], Default: 1.7.
|
278
|
+
bytecode.version=1.7
|
279
|
+
|
280
|
+
# Set whether JMX management is enabled.
|
281
|
+
# Options: [true, false], Default: false.
|
282
|
+
management.enabled=false
|
283
|
+
|
284
|
+
# Make non-local flow jumps generate backtraces.
|
285
|
+
# Options: [true, false], Default: false.
|
286
|
+
jump.backtrace=false
|
287
|
+
|
288
|
+
# Do not unwrap process streams (issue on some recent JVMs).
|
289
|
+
# Options: [true, false], Default: false.
|
290
|
+
process.noUnwrap=false
|
291
|
+
|
292
|
+
# Before instantiation, stand up a real Java class for ever Ruby class.
|
293
|
+
# Options: [true, false], Default: false.
|
294
|
+
reify.classes=false
|
295
|
+
|
296
|
+
# Log errors during reification (reify.classes=true).
|
297
|
+
# Options: [true, false], Default: false.
|
298
|
+
reify.logErrors=false
|
299
|
+
|
300
|
+
# Use reflection for binding methods, not generated bytecode.
|
301
|
+
# Options: [true, false], Default: false.
|
302
|
+
reflected.handles=false
|
303
|
+
|
304
|
+
# Enable colorized backtraces.
|
305
|
+
# Options: [true, false], Default: false.
|
306
|
+
backtrace.color=false
|
307
|
+
|
308
|
+
# Set the style of exception backtraces.
|
309
|
+
# Options: [normal, raw, full, mri], Default: normal.
|
310
|
+
backtrace.style=normal
|
311
|
+
|
312
|
+
# Mask .java lines in Ruby backtraces.
|
313
|
+
# Options: [true, false], Default: false.
|
314
|
+
backtrace.mask=false
|
315
|
+
|
316
|
+
# Set the signal used for dumping thread stacks.
|
317
|
+
# Options: [USR1, USR2, etc], Default: USR2.
|
318
|
+
thread.dump.signal=USR2
|
319
|
+
|
320
|
+
# Use native impls for parts of net/protocol.
|
321
|
+
# Options: [true, false], Default: false.
|
322
|
+
native.net.protocol=false
|
323
|
+
|
324
|
+
# Use JVM coroutines for Fiber.
|
325
|
+
# Options: [true, false], Default: false.
|
326
|
+
fiber.coroutines=false
|
327
|
+
|
328
|
+
# Use a single global lock for requires.
|
329
|
+
# Options: [true, false], Default: false.
|
330
|
+
global.require.lock=false
|
331
|
+
|
332
|
+
# Do a true process-obliterating native exec for Kernel#exec.
|
333
|
+
# Options: [true, false], Default: true.
|
334
|
+
native.exec=true
|
335
|
+
|
336
|
+
|
337
|
+
# ################################################################################
|
338
|
+
# # debugging and logging settings
|
339
|
+
# ################################################################################
|
340
|
+
|
341
|
+
# # Log require/load file searches.
|
342
|
+
# # Options: [true, false], Default: false.
|
343
|
+
# debug.loadService=false
|
344
|
+
|
345
|
+
# # Log require/load parse+evaluate times.
|
346
|
+
# # Options: [true, false], Default: false.
|
347
|
+
# debug.loadService.timing=false
|
348
|
+
|
349
|
+
# # Log externally-launched processes.
|
350
|
+
# # Options: [true, false], Default: false.
|
351
|
+
# debug.launch=false
|
352
|
+
|
353
|
+
# # Set whether full traces are enabled (c-call/c-return).
|
354
|
+
# # Options: [true, false], Default: false.
|
355
|
+
# debug.fullTrace=false
|
356
|
+
|
357
|
+
# # Print which script is executed by '-S' flag.
|
358
|
+
# # Options: [true, false], Default: false.
|
359
|
+
# debug.scriptResolution=false
|
360
|
+
|
361
|
+
# # disables JRuby impl script loads and prints parse exceptions
|
362
|
+
# # Options: [true, false], Default: false.
|
363
|
+
# debug.parser=false
|
364
|
+
|
365
|
+
# # Generate backtraces for heavily-used Errno exceptions (EAGAIN).
|
366
|
+
# # Options: [true, false], Default: false.
|
367
|
+
# errno.backtrace=false
|
368
|
+
|
369
|
+
# # Log every time an exception is constructed.
|
370
|
+
# # Options: [true, false], Default: false.
|
371
|
+
# log.exceptions=false
|
372
|
+
|
373
|
+
# # Log every time an exception backtrace is generated.
|
374
|
+
# # Options: [true, false], Default: false.
|
375
|
+
# log.backtraces=false
|
376
|
+
|
377
|
+
# # Log every time a Kernel#caller backtrace is generated.
|
378
|
+
# # Options: [true, false], Default: false.
|
379
|
+
# log.callers=false
|
380
|
+
|
381
|
+
# # Log every time a built-in warning backtrace is generated.
|
382
|
+
# # Options: [true, false], Default: false.
|
383
|
+
# log.warnings=false
|
384
|
+
|
385
|
+
# # Use specified class for logging.
|
386
|
+
# # Options: [class name], Default: org.jruby.util.log.JavaUtilLoggingLogger.
|
387
|
+
# logger.class=org.jruby.util.log.JavaUtilLoggingLogger
|
388
|
+
|
389
|
+
|
390
|
+
# ################################################################################
|
391
|
+
# # java integration settings
|
392
|
+
# ################################################################################
|
393
|
+
|
394
|
+
# # Try to set inaccessible Java methods to be accessible.
|
395
|
+
# # Options: [true, false], Default: true.
|
396
|
+
# ji.setAccessible=true
|
397
|
+
|
398
|
+
# # Log whether setAccessible is working.
|
399
|
+
# # Options: [true, false], Default: false.
|
400
|
+
# ji.logCanSetAccessible=false
|
401
|
+
|
402
|
+
# # Allow Capitalized Java pacakge names.
|
403
|
+
# # Options: [true, false], Default: false.
|
404
|
+
# ji.upper.case.package.name.allowed=false
|
405
|
+
|
406
|
+
# # Use java.lang.reflect.Proxy for interface impl.
|
407
|
+
# # Options: [true, false], Default: false.
|
408
|
+
# interfaces.useProxy=false
|
409
|
+
|
410
|
+
# # Use generated handles instead of reflection for calling Java.
|
411
|
+
# # Options: [true, false], Default: false.
|
412
|
+
# java.handles=false
|
413
|
+
|
414
|
+
# # Extend Java classes without using a proxy object.
|
415
|
+
# # Options: [true, false], Default: false.
|
416
|
+
# ji.newStyleExtension=false
|
417
|
+
|
418
|
+
# # Cache Java object wrappers between calls.
|
419
|
+
# # Options: [true, false], Default: true.
|
420
|
+
# ji.objectProxyCache=true
|
421
|
+
|
422
|
+
# # Allow external envs to replace JI proxy class factory
|
423
|
+
# # Options: [String], Default: null.
|
424
|
+
# ji.proxyClassFactory=null
|
425
|
+
|
426
|
+
|
427
|
+
# ################################################################################
|
428
|
+
# # profiling settings
|
429
|
+
# ################################################################################
|
430
|
+
|
431
|
+
# # Maximum number of methods to consider for profiling.
|
432
|
+
# # Options: [Integer], Default: 100000.
|
433
|
+
# profile.max.methods=100000
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,56 +4,65 @@ Apache License 2.0 see http://www.apache.org/licenses/LICENSE-2.0
|
|
4
4
|
|
5
5
|
Jrjackson:
|
6
6
|
|
7
|
-
a jruby library wrapping the JAVA
|
7
|
+
a jruby library wrapping the JAVA Jackson jars
|
8
8
|
|
9
|
-
Version: 0.0
|
9
|
+
Version: 0.2.0
|
10
10
|
|
11
11
|
NOTE: Smile support has been temporarily dropped
|
12
12
|
|
13
13
|
The code has been refactored to use almost all Java.
|
14
14
|
|
15
|
-
There is
|
15
|
+
There is now a MultiJson adapter added for JrJackson
|
16
16
|
|
17
|
-
provides:
|
17
|
+
JrJackson provides:
|
18
18
|
|
19
19
|
```
|
20
|
-
JrJackson::Json.load(
|
20
|
+
JrJackson::Json.load(string, options) -> hash like object
|
21
21
|
aliased as parse
|
22
22
|
JrJackson::Json.dump(obj) -> json string
|
23
23
|
aliased as generate
|
24
24
|
```
|
25
25
|
|
26
26
|
By default the load method will return Ruby objects (Hashes have string keys).
|
27
|
-
The options hash respects
|
27
|
+
The options hash respects three symbol keys
|
28
28
|
:symbolize_keys
|
29
29
|
Will return symbol keys in hashes
|
30
30
|
:raw
|
31
31
|
Will return JRuby wrapped java objects that quack like ruby objects
|
32
32
|
This is the fastest option
|
33
|
+
:use_bigdecimal
|
34
|
+
Will return BigDecimal objects instead of Float
|
35
|
+
If used with the :raw option you will get Java::JavaMath::BigDecimal objects
|
36
|
+
otherwise they are Ruby BigDecimal
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
JrJackson::Raw
|
38
|
+
Note: the dump method expects that the values of hashes or arrays are JSON data types,
|
39
|
+
the only exception to this is Ruby Symbol as values, they are converted to java strings
|
40
|
+
during serialization. All other objects should be converted to JSON data types before
|
41
|
+
serialization.
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
+
There are two Ruby sub modules of the JrJackson module
|
44
|
+
|
45
|
+
JrJackson::Json, this is the general external facade used by MultiJson, and is pure Ruby
|
46
|
+
JrJackson::Raw, this is used by the Json module, it is defined in Java with annotations
|
47
|
+
exposing it as a Ruby module with module methods.
|
48
|
+
|
49
|
+
If you are using JrJackson directly and not via MultiJson then you can take advantage of
|
50
|
+
optimised Java methods parse_raw, parse_sym and parse_str. Please look at the tests and
|
51
|
+
benchmarks for examples.
|
43
52
|
|
44
53
|
Credit to Chuck Remes for the benchmark and initial
|
45
54
|
investigation when the jruby, json gem and the jackson
|
46
55
|
libraries were young.
|
47
56
|
|
48
|
-
I compared Json (java) 1.
|
57
|
+
I compared Json (java) 1.8, Gson 0.6.1 and jackson 2.2.2 on jruby 1.7.4 and OpenJDK 64-Bit Server VM 1.7.0_21-b02
|
49
58
|
```
|
50
59
|
user system total real
|
51
|
-
|
52
|
-
gson parse: 11.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
gson generate: 5.
|
58
|
-
jackson generate: 4.
|
60
|
+
json java parse: 10.140000 0.020000 10.160000 ( 9.867000)
|
61
|
+
gson parse: 11.510000 0.010000 11.520000 ( 11.164000)
|
62
|
+
jackson parse raw: 4.320000 0.020000 4.340000 ( 3.552000)
|
63
|
+
jackson parse symbol keys: 5.910000 0.010000 5.920000 ( 5.770000)
|
64
|
+
jackson parse string keys: 8.400000 0.010000 8.410000 ( 8.232000)
|
65
|
+
json java generate: 14.730000 0.010000 14.740000 ( 13.864000)
|
66
|
+
gson generate: 5.060000 0.010000 5.070000 ( 4.981000)
|
67
|
+
jackson generate: 4.540000 0.000000 4.540000 ( 4.467000)
|
59
68
|
```
|