# Xiaoyifang/goldendict 加载图片词典比较慢，不知能否优化？

**URL:** <https://forum.freemdict.com/t/topic/23713>\
**Category:** 软件经验交流展望\
**Tags:** goldendict\
**Created:** [2023 年9 月 29 日 11:52 UTC](https://forum.freemdict.com/t/topic/23713 "2023-09-29T11:52:15Z")\
**Posts on this page:** 1\
**Showing post:** 53

<div class="post-metadata">

作者： ![last\_idol](https://forumcdn.freemdict.com/user_avatar/forum.freemdict.com/last_idol/32/2205_2.png) [@last\_idol](https://forum.freemdict.com/u/last_idol)\
发布日期： [2023 年10 月 10 日 00:01 UTC](https://forum.freemdict.com/t/topic/23713/53 "2023-10-10T00:01:31Z")

</div>

> [@GoldenDict-ng(Linux/macOS/Windows)基于Qt5.15.2/Qt6.X版本](https://forum.freemdict.com/t/topic/11495/2794):
>
> 在历史面板重复点击同一个词条，stalled 只有 1-2 ms，切换词条 stalled 变成 30-50 ms，我看这两种情况，资源都是重新加载的。

@xiaoyifang @slbtty stalled 耗时过长的原因应该是受界面元素更新的影响，相同词条的加载，不需要更新界面，所以没这问题，验证了下这个想法，注释掉 articleview 里所有更新相关的代码行后，stalled 可以降到 1-2 ms。创建新项目复现不了这个问题，应该也是这个原因。

目前发现 stalled 受影响严重的两处地方：

`ui.tabWidget->setTabText( index, escaped );` [#L1950](https://github.com/xiaoyifang/goldendict-ng/blob/staged/src/ui/mainwindow.cc#L1950) [#L490](https://github.com/xiaoyifang/goldendict-ng/blob/staged/src/ui/articleview.cc#L490)

`emit sendWordToHistory( word );` [#L361](https://github.com/xiaoyifang/goldendict-ng/blob/staged/src/ui/articleview.cc#L361)

注释掉这两处代码行后，stalled 从 45ms 下降到了 19ms，之后测试了多张图片 stalled 这个值基本稳定在 20ms 以下。这个问题要解决可能很棘手。

 ![截屏2023-10-10 07.14.20](https://forumcdn.freemdict.com/uploads/default/original/3X/4/a/4a07a3499b39f94196571b4f447d9fdf5477d351.png)

---

_[View the full topic](https://forum.freemdict.com/t/topic/23713)._
