Migrate to isp-lib scripts

This commit is contained in:
Кирющенко Егор Александрович authored and Мержанов Максим Владимирович committed 2020-12-29 15:04:34 +03:00
1 parent fb1deb0bc9
commit 3501be7ebb
9 files changed
+53 -191

No files matched your search

+7 -4
View File
@@ -7,11 +7,11 @@ import (
"os"
"testing"
"github.com/integration-system/isp-lib/v2/scripts"
"isp-script-service/adapter"
"isp-script-service/conf"
"isp-script-service/controller"
"isp-script-service/domain"
"isp-script-service/script"
"isp-script-service/service"
"github.com/integration-system/isp-lib/v2/config"
@@ -91,8 +91,9 @@ func BenchmarkJsCustomData(b *testing.B) {
if err != nil {
panic(err)
}
scriptEngine := scripts.NewEngine()
for i := 0; i < b.N; i++ {
_, _ = script.Default().Execute(scr, request.Arg)
_, _ = scriptEngine.Execute(scr, request.Arg)
}
}
@@ -105,8 +106,9 @@ func BenchmarkInlineJson(b *testing.B) {
if err != nil {
panic(err)
}
scriptEngine := scripts.NewEngine()
for i := 0; i < b.N; i++ {
_, err := script.Default().Execute(c, string(data))
_, err := scriptEngine.Execute(c, string(data))
if err != nil {
panic(err)
}
@@ -123,12 +125,13 @@ func BenchmarkJsoniterJson(b *testing.B) {
panic(err)
}
json := jsoniter.ConfigFastest
scriptEngine := scripts.NewEngine()
for i := 0; i < b.N; i++ {
m := make(map[string]interface{})
if err := json.Unmarshal(data, &m); err != nil {
panic(err)
}
res, err := script.Default().Execute(c, m)
res, err := scriptEngine.Execute(c, m)
if err != nil {
panic(err)
}