The Extraction mkMapping (https://github.com/lift/framework/blob/master/core/json/src/main/scala/net/liftweb/json/Extraction.scala#L86) and decompose (https://github.com/lift/framework/blob/master/core/json/src/main/scala/net/liftweb/json/Extraction.scala#L195) methods have code to determine if a tuple is being used and whether this should be considered as formatted as array. The tuple_? method is a Seq that contains the classes for the 22 varieties of tuples and the tuple_? method does a contains (O(n)) on this frequently during the case class serialization / deserialization process. Currently, the code performs contains first and then evaluates whether Tuples are formatted as arrays (where the default is false). This change reverses the order to short circuit evaluating contains.
The code change (https://github.com/lift/framework/compare/master...chriswebster:pf2?expand=1)
The performance improvement (using the benchmark https://github.com/chriswebster/lift-jsonBenchmark), shows a 5% performance improvement.
Benchmark data
master
[info] LiftJsonBenchmark.serializeCaseClass thrpt 20 628998.515 ± 7922.546 ops/s
after above patch
[info] LiftJsonBenchmark.serializeCaseClass thrpt 20 661524.374 ± 5817.797 ops/s
Please consider this change for inclusion into the codebase.
Chris
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.