-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Cache generic param names #3176
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
Conversation
@harawata Any concerns here? I don't see any real difference on processing of a build along with tests from any outstanding builds. This is probably very micro here at caching so not fully seeing the value. Plus seems odd that we prep for full 255 when that number is probably more often than not too high. |
Yeah. It is rare to see a statement with 5+ parameters. It might be possible to cache only the first five or ten names and create the others on the fly, but it requires an extra check, so ... I'm not sure. genericParamName = i < 10 ? CACHED[i] : PREFIX + (i + 1); |
Adding an environment variable to change this value may be better. |
1 similar comment
Adding an environment variable to change this value may be better. |
@kang-hl , I prefer not to add a new config option for this. |
Only a few at most, but not everyone is like this. Can only add one environment variable or an extra check or keep it as is, which one do you prefer? |
Let's just cache the first ten names. And we can change it anytime if we need to. |
Modified. |
@@ -132,7 +140,7 @@ public Object getNamedParams(Object[] args) { | |||
for (Map.Entry<Integer, String> entry : names.entrySet()) { | |||
param.put(entry.getValue(), args[entry.getKey()]); | |||
// add generic param names (param1, param2, ...) | |||
final String genericParamName = GENERIC_NAME_PREFIX + (i + 1); | |||
final String genericParamName = GENERIC_NAME_CACHE[i]; |
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.
for i > 10
this will return a ArrayIndexOutOfBoundsException
,
Thank you for the PR, @kang-hl ! |
No description provided.