mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-27 03:10:08 +08:00
refactor: replace json with json-iterator/go to improve performance
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package boomer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -13,6 +12,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/push"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/hrp/internal/json"
|
||||
)
|
||||
|
||||
// Output is primarily responsible for printing test results to different destinations
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package boomer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/httprunner/hrp/internal/json"
|
||||
)
|
||||
|
||||
type transaction struct {
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/csv"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
@@ -15,9 +14,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/httprunner/hrp/internal/json"
|
||||
)
|
||||
|
||||
var Functions = map[string]interface{}{
|
||||
|
||||
@@ -2,7 +2,6 @@ package har2case
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
@@ -17,6 +16,7 @@ import (
|
||||
"github.com/httprunner/hrp"
|
||||
"github.com/httprunner/hrp/internal/builtin"
|
||||
"github.com/httprunner/hrp/internal/ga"
|
||||
"github.com/httprunner/hrp/internal/json"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
14
internal/json/json.go
Normal file
14
internal/json/json.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
|
||||
var (
|
||||
Marshal = json.Marshal
|
||||
MarshalIndent = json.MarshalIndent
|
||||
Unmarshal = json.Unmarshal
|
||||
NewDecoder = json.NewDecoder
|
||||
)
|
||||
Reference in New Issue
Block a user