feat: SummaryModel增加type_count#448
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a type_count field to SummaryModel to store raw counts of evaluation labels, separating them from the calculated type_ratio percentages. It also adds a helper method _refresh_type_ratio to compute ratios from counts. A review comment highlights a performance issue where _refresh_type_ratio is unnecessarily called inside a loop for every processed item, suggesting its removal since the ratio is already refreshed in summarize.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| self.summary.score = round( | ||
| self.summary.num_good / self.summary.total * 100, 2 | ||
| ) | ||
| self._refresh_type_ratio(self.summary) |
There was a problem hiding this comment.
在列表分析咉合中,为每个处理的数据项都调用 self._refresh_type_ratio(self.summary) 会导致严重的性能问题。
_refresh_type_ratio 需要遍历所有的字段和标签来重新计算比例,其时间复杂度为
实际上
write_single_data并不依赖type_ratio。- 每次写入 summary 时调用的
self.summarize(self.summary)内部已经调用乆_refresh_type_ratio。 - 在
execute结束时,也会调用self.summarize来生成最终的 summary。
因此,建议移除此处的 self._refresh_type_ratio(self.summary)。如果需要确保 get_summary() 随时获取最新的 type_ratio,可以在 get_summary() 方法中按需调用 _refresh_type_ratio。
| self.summary.score = round( | |
| self.summary.num_good / self.summary.total * 100, 2 | |
| ) | |
| self._refresh_type_ratio(self.summary) | |
| self.summary.score = round( | |
| self.summary.num_good / self.summary.total * 100, 2 | |
| ) |
No description provided.