Improve block loading performance on Windows/Linux/macOS amd64 arch https://github.com/siyuan-note/siyuan/issues/9084

This commit is contained in:
Daniel 2023-09-01 11:09:39 +08:00
parent a54ddd5c8e
commit a63e1fda2e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 10 additions and 18 deletions

View file

@ -19,18 +19,14 @@
package filesys
import (
"time"
"github.com/goccy/go-json"
"github.com/siyuan-note/logging"
)
func unmarshalJSON(data []byte, v interface{}) error {
now := time.Now()
defer func() {
elapsed := time.Since(now)
logging.LogInfof("[go-json] unmarshalJSON took %s", elapsed)
}()
//now := time.Now()
//defer func() {
// elapsed := time.Since(now)
// logging.LogInfof("[go-json] unmarshalJSON took %s", elapsed)
//}()
return json.Unmarshal(data, v)
}

View file

@ -17,18 +17,14 @@
package filesys
import (
"time"
"github.com/bytedance/sonic"
"github.com/siyuan-note/logging"
)
func unmarshalJSON(data []byte, v interface{}) error {
now := time.Now()
defer func() {
elapsed := time.Since(now)
logging.LogInfof("[sonic] unmarshalJSON took %s", elapsed)
}()
//now := time.Now()
//defer func() {
// elapsed := time.Since(now)
// logging.LogInfof("[sonic] unmarshalJSON took %s", elapsed)
//}()
return sonic.Unmarshal(data, v)
}