mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
⚡ Improve database loading performance https://github.com/siyuan-note/siyuan/issues/15115
This commit is contained in:
parent
2e2f152311
commit
17369d28c9
3 changed files with 47 additions and 11 deletions
|
|
@ -276,6 +276,34 @@ func nodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
|
|||
return buf.String()
|
||||
}
|
||||
|
||||
func BatchGetBlockAttrsWitTrees(ids []string, trees map[string]*parse.Tree) (ret map[string]map[string]string) {
|
||||
ret = map[string]map[string]string{}
|
||||
|
||||
hitCache := true
|
||||
for _, id := range ids {
|
||||
ial := cache.GetBlockIAL(id)
|
||||
if nil != ial {
|
||||
ret[id] = ial
|
||||
continue
|
||||
}
|
||||
hitCache = false
|
||||
break
|
||||
}
|
||||
if hitCache {
|
||||
return
|
||||
}
|
||||
|
||||
for _, id := range ids {
|
||||
tree := trees[id]
|
||||
if nil == tree {
|
||||
continue
|
||||
}
|
||||
|
||||
ret[id] = getBlockAttrsFromTree(id, tree)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BatchGetBlockAttrs(ids []string) (ret map[string]map[string]string) {
|
||||
ret = map[string]map[string]string{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue