Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:zap: 改进打开虚拟引用后加载文档的性能 https://github.com/siyuan-note/siyuan/issues/7378

Liang Dingc1b457eb76a9
diff --git a/kernel/model/file.go b/kernel/model/file.go
index ece4df2463..7bddac1c52 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -605,7 +605,6 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
}
refCount := sql.QueryRootChildrenRefCount(rootID)
- //virtualBlockRefKeywords := getVirtualRefKeywords(tree.Root.IALAttr("title"))
virtualBlockRefKeywords := getBlockVirtualRefKeywords(tree.Root)
subTree := &parse.Tree{ID: rootID, Root: &ast.Node{Type: ast.NodeDocument}, Marks: tree.Marks}
diff --git a/kernel/model/virutalref.go b/kernel/model/virutalref.go
index fe9f97262c..510f2bab81 100644
--- a/kernel/model/virutalref.go
+++ b/kernel/model/virutalref.go
@@ -50,23 +50,7 @@ var virtualBlockRefCache, _ = ristretto.NewCache(&ristretto.Config{
func getBlockVirtualRefKeywords(root *ast.Node) (ret []string) {
val, ok := virtualBlockRefCache.Get(root.ID)
if !ok {
- treeTitle := root.IALAttr("title")
- buf := bytes.Buffer{}
- ast.Walk(root, func(n *ast.Node, entering bool) ast.WalkStatus {
- if !entering || !n.IsBlock() {
- return ast.WalkContinue
- }
-
- content := treenode.NodeStaticContent(n, nil)
- buf.WriteString(content)
- return ast.WalkContinue
- })
- content := buf.String()
- putBlockVirtualRefKeywords(content, root.ID, treeTitle)
- val, ok = virtualBlockRefCache.Get(root.ID)
- if !ok {
- return
- }
+ return
}
ret = val.([]string)
return
@@ -141,8 +125,8 @@ func CacheVirtualBlockRefJob() {
})
poolSize := runtime.NumCPU()
- if 4 < poolSize {
- poolSize = 4
+ if 8 < poolSize {
+ poolSize = 8
}
i := 0
waitGroup := &sync.WaitGroup{}