From 04ec56eed8337121a6f81e84d58aaa77f7cdb7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=95=E8=88=9E=E5=85=AB=E5=BC=A6?= <1677759063@qq.com> Date: Tue, 6 Feb 2024 18:02:25 +0800 Subject: [PATCH] =?UTF-8?q?perf(hr):=20=E4=BC=98=E5=8C=96=E7=AE=97?= =?UTF-8?q?=E6=B3=95=20(#71)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf(hr): 优化算法 * chore: remove log --- src/widgets/HrCalculator/index.vue | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/widgets/HrCalculator/index.vue b/src/widgets/HrCalculator/index.vue index 541aad81..71be0453 100644 --- a/src/widgets/HrCalculator/index.vue +++ b/src/widgets/HrCalculator/index.vue @@ -69,23 +69,16 @@ export default defineComponent({ }); function calc() { const result: Record }> = {}; - const subset = value.bitmap.getSubSet(); for (const [charIndex, c] of props.source.entries()) { for (const set of c.subset) { - for (const group of subset) { - // 干员的子集中的一个元素 是这个选中的子集中的一个元素 的子集 - if ((group & set) !== group) continue; - - // 6星要有对应的稀有度tag才能出 - if (c.rarity === 5 && !can5(group)) continue; - - if (!result[group]) { - result[group] = { - charIndict: new Set(), - }; - } - result[group].charIndict.add(charIndex); + if ((value.bitmap.value | set) !== value.bitmap.value) continue; + if (c.rarity === 5 && !can5(set)) continue; + if (!result[set]) { + result[set] = { + charIndict: new Set(), + }; } + result[set].charIndict.add(charIndex); } } const list: Array<{ tags: number; charIndict: number[]; score: number }> =