Skip to content

Commit

Permalink
2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Mar 19, 2020
1 parent 70ac702 commit 92656d0
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 121 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog

## 2.6.1 - 2020-03-19

### Changed

- Serialization is 10-20% faster and uses about 50% less memory by writing
directly to the returned `bytes` object.

## 2.6.0 - 2020-03-10

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "orjson"
version = "2.6.0"
version = "2.6.1"
authors = ["ijl <ijl@mailbox.org>"]
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"
edition = "2018"
Expand Down
246 changes: 134 additions & 112 deletions README.md

Large diffs are not rendered by default.

Binary file modified doc/canada_deserialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/canada_serialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/citm_catalog_deserialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/citm_catalog_serialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/github_deserialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/github_serialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/twitter_deserialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/twitter_serialization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions pynumpy
Expand Up @@ -9,14 +9,15 @@ import sys
import time
from timeit import timeit

import numpy
import orjson
import psutil
import rapidjson
import simplejson
from memory_profiler import memory_usage
from tabulate import tabulate

import numpy

os.sched_setaffinity(os.getpid(), {0, 1})


Expand All @@ -28,15 +29,10 @@ elif kind == "float64":
array = numpy.random.random(size=(50000, 100))
assert array.dtype == numpy.float64
elif kind == "bool":
array = numpy.random.choice((True, False), size=(100000, 100))
array = numpy.random.choice((True, False), size=(100000, 200))
else:
print("usage: pynumpy (bool|int32|float64)")
sys.exit(1)

output_in_mib = len(orjson.dumps(array.tolist())) / 1024 / 1024

print(f"{output_in_mib:,.1f}MiB {kind} output (orjson)")

proc = psutil.Process()


Expand All @@ -57,6 +53,10 @@ rapidjson_dumps = lambda: rapidjson.dumps(array, default=default).encode("utf-8"
simplejson_dumps = lambda: simplejson.dumps(array, default=default).encode("utf-8")
json_dumps = lambda: json.dumps(array, default=default).encode("utf-8")

output_in_mib = len(orjson_dumps()) / 1024 / 1024

print(f"{output_in_mib:,.1f}MiB {kind} output (orjson)")

gc.collect()
mem_before = proc.memory_full_info().rss / 1024 / 1024

Expand Down

0 comments on commit 92656d0

Please sign in to comment.