Lift-Json performance optimization

16 views
Skip to first unread message

Chris Webster

unread,
Jul 25, 2017, 8:59:52 PM7/25/17
to Lift
Hi,

I noticed that JsonAST appendEscapeString was creating a Range object when iterating over the characters that were being copied, via Range.foreach. This was resulting in some additional objects being created (namely the Range object itself, which creates an AbstractSeq due to the class hierarchy. I made a change to eliminate the use of Range in appendEscapedString and observed a 12-18% performance increase (using https://github.com/chriswebster/lift-jsonBenchmark for a benchmark). 

Here is what the code change (https://github.com/lift/framework/compare/master...chriswebster:fe?expand=1) would look like. 

Please consider accepting a PR for this. 

Chris 



Matt Farmer

unread,
Jul 25, 2017, 10:47:59 PM7/25/17
to Lift
Looks like a solid improvement. Go ahead and open a PR and I'll take a look at the performance comparison myself sometime later this week.

Thanks!

--
--
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.

Chris Webster

unread,
Jul 26, 2017, 12:17:08 AM7/26/17
to Lift
Reply all
Reply to author
Forward
0 new messages