-
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.
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.
Yeah I can understand, it's quite messy. Let's not consider it then.
implementation/src/main/java/io/smallrye/config/ProfileConfigSourceInterceptor.java
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/config/SecretKeysConfigSourceInterceptor.java
Show resolved
Hide resolved
Yeah, very interested in your feedback. I banged my head on it for a while. It should be faster but from my tests, it's consistently a tiny bit slower.
Done for the ones that had a |
Great! Thanks! |
I had a look and even expanded the idea further, by applying it to all leaf elements: There is a marginal improvement compared to the same kind of work, which almost feels not worth it. I measured 6882 k samples vs 6861 k, so nothing major. Now, if you were comparing old root vs new mapping for Vert.x config, yes, you are always going to notice a tiny decrease because we do a few extra things:
It's a bit tricky to get rid of these:
We can definitely look into improving some things, but it does feel that the gain would be marginal. For instance, the |
My reasoning for trying to improve this was that once all the extensions are moved to Especially since this price is paid just by having more config properties around in your app, not by actually using them.
I can see why it could be useful in some cases but I wonder if we could mark trees specifically to disable this feature? For anything that is in the core Quarkus extensions, I don't think we need this flexibility? Note that it might be a stupid idea but, if this cost is important, we could add additional constraints to the Quarkus config - especially since I don't think it makes sense to reuse the Quarkus config in other trees - and if you do, you would have to follow our naming convention. |
Absolutely, you are correct. That is why I was suggesting that we look into things from another angle. While every bit counts, we also know these will be marginal. If you consider an application with vertx, arc and rest, it has more than 600 configurations. Each configuration has to be queried in each source until found, which in most cases is the default, or not found in the case of optionals. Lookups are actually double because we also look for the profiled configuration. Rough numbers: 4 sources * 600 configurations * 2 profiles. We could probably improve the situation if we could think of a way to considerably reduce the number of lookups. I have a couple of ideas, but it would be great to have other people think about this.
I didn't measure that cost specifically, and yes, we don't need this in our Quarkus config. It is not a stupid idea, is just a matter of measuring the effort and benefit. My gut feeling is that the benefit would be marginal, but let me measure it first and see what we can gain. Again, I'm not saying we shouldn't do it, but I think that we can probably have better improvements in other areas. |
@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 :).