-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
加快docx导出速度、更详细的过程输出 #296
Merged
Merged
加快docx导出速度、更详细的过程输出 #296
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
可用于判断程序是在缓慢处理中还是卡了,对于特别多的对话记录,ui进度条是几乎不动的
对话记录特别多的时候,越往后word文件越大,添加一个记录所需时间也越长。 先将每200条记录保存,最后合并在一起,将整个过程大大加快。
我批量导出三个人的达到了7G,而有些人总是喜欢全选 |
确实,我刚全选试了一下,内存吃到8G多。 |
我之前的解决方案是分n份用多线程处理,保存n个docx文件,最后再合并到一起再把n个文件删了 |
试了一下,无论是在newdoc里一边导出一边合并,还是在newdoc里直接保存后面拼起来,在单线程的情况下都没能缓解内存问题。
|
试试最新代码 |
最新代码成功解决该问题,不会再出现非法字符报错。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
📝 补充信息 | Additional Information
之前我在使用软件时,因为一份对话过多,导出时间太长了,进度条一直在99%,无法确定是程序卡了还是在处理中。于是,我为一些耗时的处理添加了过程输出,这样用户就可以知道程序在运行,而不是报错卡了。
对于一次共22736条消息的导出,新的 docx 导出方法用173s完成整个导出,而原版在200s时仅完成了5625条,大概四分之一,并且越来越慢。
![image](https://private-user-images.githubusercontent.com/36418285/295918845-eac5947c-41c4-4ff6-94f6-0a6deae2dc7c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzM3NTYsIm5iZiI6MTczOTU3MzQ1NiwicGF0aCI6Ii8zNjQxODI4NS8yOTU5MTg4NDUtZWFjNTk0N2MtNDFjNC00ZmY2LTk0ZjYtMGE2ZGVhZTJkYzdjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIyNTA1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM5OWRkYmJjODcwMmM1NmY1MThiMjg1YjZjNjlmZDRhYmM0NDIzMTNmZDNkYjlmMjYxMmQ5YWVlZDQ2MjdjMmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.054_ku1MkIRekTCSktQ8dIWcZLdxAJP8JrkNYkfJJ6Q)
(↓这是原版↓)
okSignal = pyqtSignal(int)
,因此 emit 1 而不是 'ok'。