mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
提升引擎性能-替换json标准库为iterator/go库
This commit is contained in:
@@ -1,14 +1,16 @@
|
|||||||
package cluster
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/duanhf2012/origin/log"
|
"github.com/duanhf2012/origin/log"
|
||||||
"github.com/duanhf2012/origin/rpc"
|
"github.com/duanhf2012/origin/rpc"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
func (slf *Cluster) ReadClusterConfig(filepath string) (*SubNet,error) {
|
func (slf *Cluster) ReadClusterConfig(filepath string) (*SubNet,error) {
|
||||||
c := &SubNet{}
|
c := &SubNet{}
|
||||||
d, err := ioutil.ReadFile(filepath)
|
d, err := ioutil.ReadFile(filepath)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package rpc
|
package rpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
jsoniter "github.com/json-iterator/go"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
type JsonProcessor struct {
|
type JsonProcessor struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package sysservice
|
package sysservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/duanhf2012/origin/event"
|
"github.com/duanhf2012/origin/event"
|
||||||
"github.com/duanhf2012/origin/network"
|
"github.com/duanhf2012/origin/network"
|
||||||
"github.com/duanhf2012/origin/service"
|
"github.com/duanhf2012/origin/service"
|
||||||
"github.com/duanhf2012/origin/util/uuid"
|
"github.com/duanhf2012/origin/util/uuid"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -15,6 +15,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
var Default_ReadTimeout time.Duration = time.Second*10
|
var Default_ReadTimeout time.Duration = time.Second*10
|
||||||
var Default_WriteTimeout time.Duration = time.Second*10
|
var Default_WriteTimeout time.Duration = time.Second*10
|
||||||
var Default_ProcessTimeout time.Duration = time.Second*10
|
var Default_ProcessTimeout time.Duration = time.Second*10
|
||||||
|
|||||||
Reference in New Issue
Block a user