Skip to content

不要 .reduce 写法#619

Merged
CodFrm merged 1 commit intoscriptscat:mainfrom
cyfung1031:no_reduce
Aug 9, 2025
Merged

不要 .reduce 写法#619
CodFrm merged 1 commit intoscriptscat:mainfrom
cyfung1031:no_reduce

Conversation

@cyfung1031
Copy link
Copy Markdown
Collaborator

scriptcat 代码没有真正用到 .reduce 的功能。不需要。拖效能又难理解

@CodFrm CodFrm merged commit 71e97d5 into scriptscat:main Aug 9, 2025
3 checks passed
@mon-jai
Copy link
Copy Markdown

mon-jai commented Aug 11, 2025

@cyfung1031 @CodFrm 這個用matchScriptUuid.filter()不是更適合嗎?

@CodFrm
Copy link
Copy Markdown
Member

CodFrm commented Aug 12, 2025

@mon-jai 看起来是可以使用filter,不过问题不大

@cyfung1031
Copy link
Copy Markdown
Collaborator Author

@cyfung1031 @CodFrm 這個用matchScriptUuid.filter()不是更適合嗎?

其实ScriptCat很多代码都还有改进空间。
这PR的 matchScriptUuidscriptRes 是分开的,无法直接合起来用 filter
getPageScriptUuidByUrl传回一个uuid的array, 而不是 cache的 ScriptMatchInfo
应该要修改 getPageScriptUuidByUrl 直接取 ScriptMatchInfo
这样就能用 .filter

filter是直观但效能不是很好。

@cyfung1031 cyfung1031 deleted the no_reduce branch August 23, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants