-
Notifications
You must be signed in to change notification settings - Fork 32
Performance improvements for JacksonConfigParser #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fbdf1b5
6088dc0
32729d3
2689e8f
a926d5c
d351774
d72d7b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# 4 space indentation | ||
[*.{py,java}] | ||
indent_style = space | ||
indent_size = 4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* | ||
* Copyright 2018, Optimizely and contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.optimizely.ab.config.parser; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add the license header to this file. You only need to include the year 2018 because it was created this year. |
||
|
||
import com.optimizely.ab.config.ProjectConfig; | ||
import com.optimizely.ab.config.ProjectConfigTestUtils; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@BenchmarkMode(Mode.AverageTime) | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
@Fork(2) | ||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 20) | ||
@State(Scope.Benchmark) | ||
public class JacksonConfigParserBenchmark { | ||
JacksonConfigParser parser; | ||
String jsonV2; | ||
String jsonV3; | ||
String jsonV4; | ||
|
||
@Setup | ||
public void setUp() throws IOException { | ||
parser = new JacksonConfigParser(); | ||
jsonV2 = ProjectConfigTestUtils.validConfigJsonV2(); | ||
jsonV3 = ProjectConfigTestUtils.validConfigJsonV3(); | ||
jsonV4 = ProjectConfigTestUtils.validConfigJsonV4(); | ||
} | ||
|
||
@Benchmark | ||
public ProjectConfig parseV2() throws ConfigParseException { | ||
return parser.parseProjectConfig(jsonV2); | ||
} | ||
|
||
@Benchmark | ||
public ProjectConfig parseV3() throws ConfigParseException { | ||
return parser.parseProjectConfig(jsonV3); | ||
} | ||
|
||
@Benchmark | ||
public ProjectConfig parseV4() throws ConfigParseException { | ||
return parser.parseProjectConfig(jsonV4); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
* | ||
* Copyright 2016-2017, Optimizely and contributors | ||
* Copyright 2016-2018, Optimizely and contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -16,17 +16,14 @@ | |
*/ | ||
package com.optimizely.ab.config; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import com.fasterxml.jackson.annotation.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update the license year to |
||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.concurrent.Immutable; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Represents the Optimizely Experiment configuration. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty cool! Will start using it in our projects :)