Skip to content

Commit

Permalink
deploy: f71d96f
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Dec 13, 2023
1 parent c79cea3 commit 45a58be
Show file tree
Hide file tree
Showing 9 changed files with 493 additions and 313 deletions.
360 changes: 228 additions & 132 deletions _sources/benchmarks.rst.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ support for JSON_, MessagePack_, YAML_, and TOML_. It features:

- 🔍 **Zero-cost schema validation** using familiar Python type annotations.
In :doc:`benchmarks <benchmarks>` ``msgspec`` decodes *and* validates JSON
~2x faster than orjson_ can decode it alone.
faster than orjson_ can decode it alone.

- ✨ **A speedy Struct type** for representing structured data. If you already
use dataclasses_ or attrs_, :doc:`structs` should feel familiar. However,
they're :ref:`10-100x <struct-benchmark>` faster for common operations.
they're :ref:`5-60x <struct-benchmark>` faster for common operations.

All of this is included in a :ref:`lightweight library
<benchmark-library-size>` with no required dependencies.
Expand Down
4 changes: 2 additions & 2 deletions _sources/perf-tips.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Use Structs
-----------

:doc:`structs` are msgspec's native way of expressing user-defined types.
They're :ref:`fast to encode/decode <encoding-benchmark>` and :ref:`fast to use
They're :ref:`fast to encode/decode <json-benchmark>` and :ref:`fast to use
<struct-benchmark>`. If you have data with a known schema, we recommend
defining a `msgspec.Struct` type (or types) for your schema and preferring that
over other types like `dict`/`dataclasses`/...
Expand Down Expand Up @@ -239,7 +239,7 @@ Use MessagePack
---------------

``msgspec`` supports both JSON_ and MessagePack_ protocols. The latter is less
commonly used, but :ref:`can be more performant <encoding-benchmark>`. If
commonly used, but :ref:`can be more performant <msgpack-benchmark>`. If
performance is an issue (and MessagePack is an acceptable solution), you may
benefit from using it instead of JSON. And since ``msgspec`` supports both
protocols with a consistent interface, switching from ``msgspec.json`` to
Expand Down
2 changes: 1 addition & 1 deletion _static/bench-validation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
426 changes: 255 additions & 171 deletions benchmarks.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ <h1>msgspec<a class="headerlink" href="#msgspec" title="Permalink to this headin
be supported through <a class="reference internal" href="extending.html"><span class="doc">extensions</span></a>.</p></li>
<li><p>🔍 <strong>Zero-cost schema validation</strong> using familiar Python type annotations.
In <a class="reference internal" href="benchmarks.html"><span class="doc">benchmarks</span></a> <code class="docutils literal notranslate"><span class="pre">msgspec</span></code> decodes <em>and</em> validates JSON
~2x faster than <a class="reference external" href="https://github.com/ijl/orjson">orjson</a> can decode it alone.</p></li>
faster than <a class="reference external" href="https://github.com/ijl/orjson">orjson</a> can decode it alone.</p></li>
<li><p><strong>A speedy Struct type</strong> for representing structured data. If you already
use <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html">dataclasses</a> or <a class="reference external" href="https://www.attrs.org">attrs</a>, <a class="reference internal" href="structs.html"><span class="doc">Structs</span></a> should feel familiar. However,
they’re <a class="reference internal" href="benchmarks.html#struct-benchmark"><span class="std std-ref">10-100x</span></a> faster for common operations.</p></li>
they’re <a class="reference internal" href="benchmarks.html#struct-benchmark"><span class="std std-ref">5-60x</span></a> faster for common operations.</p></li>
</ul>
<p>All of this is included in a <a class="reference internal" href="benchmarks.html#benchmark-library-size"><span class="std std-ref">lightweight library</span></a> with no required dependencies.</p>
<hr class="docutils" />
Expand Down
Binary file modified objects.inv
Binary file not shown.
4 changes: 2 additions & 2 deletions perf-tips.html
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ <h2>Reuse Encoders/Decoders<a class="headerlink" href="#reuse-encoders-decoders"
<section id="use-structs">
<h2>Use Structs<a class="headerlink" href="#use-structs" title="Permalink to this heading">#</a></h2>
<p><a class="reference internal" href="structs.html"><span class="doc">Structs</span></a> are msgspec’s native way of expressing user-defined types.
They’re <a class="reference internal" href="benchmarks.html#encoding-benchmark"><span class="std std-ref">fast to encode/decode</span></a> and <a class="reference internal" href="benchmarks.html#struct-benchmark"><span class="std std-ref">fast to use</span></a>. If you have data with a known schema, we recommend
They’re <a class="reference internal" href="benchmarks.html#json-benchmark"><span class="std std-ref">fast to encode/decode</span></a> and <a class="reference internal" href="benchmarks.html#struct-benchmark"><span class="std std-ref">fast to use</span></a>. If you have data with a known schema, we recommend
defining a <a class="reference internal" href="api.html#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.Struct</span></code></a> type (or types) for your schema and preferring that
over other types like <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.12)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dict</span></code></a>/<a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.12)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a>/…</p>
</section>
Expand Down Expand Up @@ -459,7 +459,7 @@ <h3>Length-Prefix Framing<a class="headerlink" href="#length-prefix-framing" tit
<section id="use-messagepack">
<h2>Use MessagePack<a class="headerlink" href="#use-messagepack" title="Permalink to this heading">#</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">msgspec</span></code> supports both <a class="reference external" href="https://json.org">JSON</a> and <a class="reference external" href="https://msgpack.org">MessagePack</a> protocols. The latter is less
commonly used, but <a class="reference internal" href="benchmarks.html#encoding-benchmark"><span class="std std-ref">can be more performant</span></a>. If
commonly used, but <a class="reference internal" href="benchmarks.html#msgpack-benchmark"><span class="std std-ref">can be more performant</span></a>. If
performance is an issue (and MessagePack is an acceptable solution), you may
benefit from using it instead of JSON. And since <code class="docutils literal notranslate"><span class="pre">msgspec</span></code> supports both
protocols with a consistent interface, switching from <code class="docutils literal notranslate"><span class="pre">msgspec.json</span></code> to
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 45a58be

Please sign in to comment.