[why] Avoid to execute some unnecessary operations and improve performance.
[how] Keep the value.size condition judgement to the front of block.
Signed-off-by: Lu Kaiyi 2392863668@qq.com --- lib/matrix2.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index ff4ea31..2065039 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -116,15 +116,15 @@ def combine_group_query_data(query_data, dims) job_list = query_data['hits']['hits'] groups = auto_group(job_list, dims) groups.each do |group_key, value| + if value.size < 2 + groups.delete(group_key) + next + end suite_list = [] value.each do |dimension_key, jobs| groups[group_key][dimension_key], suites = create_matrix(jobs) suite_list.concat(suites) end - if value.size < 2 - groups.delete(group_key) - next - end suites_list << suite_list end
On Fri, Nov 20, 2020 at 09:15:06AM +0800, Lu Kaiyi wrote:
[why] Avoid to execute some unnecessary operations and improve performance.
[how] Keep the value.size condition judgement to the front of block.
Keep => Move
I think it's obvious in your code, you may not need this [how].
Thanks, Yuanchao
On Fri, Nov 20, 2020 at 09:55:46AM +0800, Li Yuanchao wrote:
On Fri, Nov 20, 2020 at 09:15:06AM +0800, Lu Kaiyi wrote:
[why] Avoid to execute some unnecessary operations and improve performance.
[how] Keep the value.size condition judgement to the front of block.
Keep => Move
I think it's obvious in your code, you may not need this [how].
Thanks, Yuanchao
ok
Thanks, Kaiyi
On Fri, Nov 20, 2020 at 09:15:06AM +0800, Lu Kaiyi wrote:
[why] Avoid to execute some unnecessary operations and improve performance.
[how] Keep the value.size condition judgement to the front of block.
Signed-off-by: Lu Kaiyi 2392863668@qq.com
lib/matrix2.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index ff4ea31..2065039 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -116,15 +116,15 @@ def combine_group_query_data(query_data, dims) job_list = query_data['hits']['hits'] groups = auto_group(job_list, dims) groups.each do |group_key, value|
- if value.size < 2
groups.delete(group_key)
next
- end
There is a next in upon if block, here should add a blank line.
Thanks, Xijian
suite_list = [] value.each do |dimension_key, jobs| groups[group_key][dimension_key], suites = create_matrix(jobs) suite_list.concat(suites) end
- if value.size < 2
groups.delete(group_key)
next
- end suites_list << suite_list end
-- 2.23.0
On Fri, Nov 20, 2020 at 10:39:58AM +0800, Xu Xijian wrote:
On Fri, Nov 20, 2020 at 09:15:06AM +0800, Lu Kaiyi wrote:
[why] Avoid to execute some unnecessary operations and improve performance.
[how] Keep the value.size condition judgement to the front of block.
Signed-off-by: Lu Kaiyi 2392863668@qq.com
lib/matrix2.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index ff4ea31..2065039 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -116,15 +116,15 @@ def combine_group_query_data(query_data, dims) job_list = query_data['hits']['hits'] groups = auto_group(job_list, dims) groups.each do |group_key, value|
- if value.size < 2
groups.delete(group_key)
next
- end
There is a next in upon if block, here should add a blank line.
Thanks, Xijian
ok
Thanks, Kaiyi
suite_list = [] value.each do |dimension_key, jobs| groups[group_key][dimension_key], suites = create_matrix(jobs) suite_list.concat(suites) end
- if value.size < 2
groups.delete(group_key)
next
- end suites_list << suite_list end
-- 2.23.0