json: use ujson to dumps

This should improve encoding speed.

Change-Id: I0492d42a80ffae6f128b9ca5875c651a6e03e59e
This commit is contained in:
Julien Danjou 2017-04-18 15:25:33 +02:00
parent 1977a1737a
commit 535afd9b13
1 changed files with 2 additions and 5 deletions

View File

@ -13,10 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import
import datetime
import json
import uuid
import numpy
@ -52,8 +49,8 @@ def to_primitive(obj):
return obj
def dumps(*args, **kwargs):
return json.dumps(*args, default=to_primitive, **kwargs)
def dumps(obj):
return ujson.dumps(to_primitive(obj))
# For convenience