-
Notifications
You must be signed in to change notification settings - Fork 121
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
Various suggestions #1277
base: main
Are you sure you want to change the base?
Various suggestions #1277
Conversation
Given we are adding quite a lot of elements, there are a lot of chances the maps will have to be resized several times.
The convertProfile() method is called several times and there's no need to create the converter again and again.
It seems counter productive to throw so many NoSuchMethodExceptions for these common uses cases.
This avoids a bunch of allocations, including the allocation of an ObjectCreator for each property. It was kept simple on purpose as a base for discussions. Note that, interestingly enough, my startup actually got a bit slower with this patch which makes little sense... I thought it might be interesting to discuss this line of thoughts anyway.
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.
Thanks!
Let me have a better look at the bytecode pieces. For the remaining changes, I think we should open separate PR's.
@@ -67,65 +67,25 @@ private Converters() { | |||
|
|||
static final Converter<ConfigValue> CONFIG_VALUE_CONVERTER = new ConfigValueConverter(); | |||
|
|||
static final Converter<String> STRING_CONVERTER = BuiltInConverter.of(0, newEmptyValueConverter(value -> value)); |
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.
I've made a similar proposal in #1249, but we ended up not moving forward with it.
@Priority(Priorities.LIBRARY + 200) | ||
public class ProfileConfigSourceInterceptor implements ConfigSourceInterceptor { | ||
private static final long serialVersionUID = -6305289277993917313L; | ||
|
||
private static final Converter<ArrayList<String>> PROFILES_CONVERTER = newCollectionConverter( |
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.
+1
return hashCode; | ||
} | ||
|
||
private int buildHashCode() { |
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.
+1
@@ -28,7 +28,7 @@ public ConfigValue getValue(final ConfigSourceInterceptorContext context, final | |||
|
|||
@Override | |||
public Iterator<String> iterateNames(final ConfigSourceInterceptorContext context) { | |||
if (SecretKeys.isLocked()) { | |||
if (!secrets.isEmpty() && SecretKeys.isLocked()) { |
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.
+1
@@ -1142,6 +1078,14 @@ static <T> Converter<T> getConverter(Class<? extends T> clazz) { | |||
return new HyphenateEnumConverter(clazz); | |||
} | |||
|
|||
// some shortcuts for common used classes | |||
if ("java.io.File".equals(clazz.getName())) { |
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.
+1
@radcortez I pushed several suggestions here. Some are easy wins that we could apply without too much discussion, some are maybe more controversial.
I would very much like to discuss Provide some shortcuts for simple config properties as this commit clearly removes some work (and I checked the generated bytecode and it looks like it's actually less work) but it seems to make things a bit slower and I wasn't able to pinpoint what was going on.
Interested in your feedback :).