Improve performance of decomposing case classes to Json #1500

Merged
merged 1 commit into from Nov 9, 2013

Conversation

Projects
None yet
4 participants
@chriswebster

The Extraction.decompose method used Class.getDeclaredField which performs a linear scan of the fields for each element in the case class constructor. This pull request does a single pass over the fields storing them in a map hence reducing the algorithm complexity to O(n).

A benchmark (https://gist.github.com/chriswebster/7291295) before and after the change showed:

Before change:
[info] Running ExtractionBenchmark 3 100000
ExtractionBenchmark$ 2675 2390 2418

After change:
info] Running ExtractionBenchmark 3 100000
ExtractionBenchmark$ 1131 843 817

@Shadowfiend

This comment has been minimized.

Show comment Hide comment
@Shadowfiend

Shadowfiend Nov 3, 2013

Owner

In the future, please read the contribution guidelines that are linked on the issue/pull request creation page before opening an issue or pull request. Please discuss PRs and bugs on the mailing list before opening a ticket. I will now close this issue; please start a thread on the mailing list and we'll reopen this once things have shaken out there. Thanks!

Owner

Shadowfiend commented Nov 3, 2013

In the future, please read the contribution guidelines that are linked on the issue/pull request creation page before opening an issue or pull request. Please discuss PRs and bugs on the mailing list before opening a ticket. I will now close this issue; please start a thread on the mailing list and we'll reopen this once things have shaken out there. Thanks!

@Shadowfiend Shadowfiend closed this Nov 3, 2013

@Shadowfiend Shadowfiend reopened this Nov 4, 2013

@Shadowfiend

This comment has been minimized.

Show comment Hide comment
@Shadowfiend

Shadowfiend Nov 4, 2013

Owner

Reopened based on Joni's go-ahead @ https://groups.google.com/forum/#!topic/liftweb/TgundT8Gcmk .

Owner

Shadowfiend commented Nov 4, 2013

Reopened based on Joni's go-ahead @ https://groups.google.com/forum/#!topic/liftweb/TgundT8Gcmk .

@farmdawgnation

This comment has been minimized.

Show comment Hide comment
@farmdawgnation

farmdawgnation Nov 6, 2013

Owner

Haven't tested it, but just glancing at the code this looks cool. 👍

Owner

farmdawgnation commented Nov 6, 2013

Haven't tested it, but just glancing at the code this looks cool. 👍

@fmpwizard

This comment has been minimized.

Show comment Hide comment
@fmpwizard

fmpwizard Nov 7, 2013

Owner

Thanks for the pull request, I'll be merging it later this week

Owner

fmpwizard commented Nov 7, 2013

Thanks for the pull request, I'll be merging it later this week

fmpwizard added a commit that referenced this pull request Nov 9, 2013

Merge pull request #1500 from chriswebster/perfFix
Improve performance of decomposing case classes to Json

@fmpwizard fmpwizard merged commit 23cfba4 into lift:master Nov 9, 2013

@fmpwizard

This comment has been minimized.

Show comment Hide comment
@fmpwizard

fmpwizard Nov 9, 2013

Owner

Thanks for your pull request !

Owner

fmpwizard commented Nov 9, 2013

Thanks for your pull request !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment