1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00
django/docs
Nick Pope b47f2f5b90 Fixed #33865 -- Optimized LimitedStream wrapper.
The current implementation of LimitedStream is slow because .read()
performs an extra copy into a buffer and .readline() performs two
extra copies. The stream being wrapped is already typically a BytesIO
object so this is unnecessary.

This implementation has largely been untouched for 12 years and,
inspired by a simpler implementation in werkzeug, it was possible to
achieve the following performance improvement:

LimitedStream.read() (single line):
  Mean +- std dev: [bench_limitedstream-main] 286 ns +- 6 ns
  -> [bench_limitedstream-patch] 227 ns +- 6 ns: 1.26x faster
LimitedStream.readline() (single line):
  Mean +- std dev: [bench_limitedstream-main] 507 ns +- 11 ns
  -> [bench_limitedstream-patch] 232 ns +- 8 ns: 2.18x faster
LimitedStream.read(8192) (single line):
  Mean +- std dev: [bench_limitedstream-main] 360 ns +- 8 ns
  -> [bench_limitedstream-patch] 297 ns +- 6 ns: 1.21x faster
LimitedStream.readline(8192) (single line):
  Mean +- std dev: [bench_limitedstream-main] 602 ns +- 10 ns
  -> [bench_limitedstream-patch] 305 ns +- 10 ns: 1.98x faster
LimitedStream.read() (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 290 ns +- 5 ns
  -> [bench_limitedstream-patch] 236 ns +- 6 ns: 1.23x faster
LimitedStream.readline() (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 517 ns +- 19 ns
  -> [bench_limitedstream-patch] 239 ns +- 7 ns: 2.16x faster
LimitedStream.read(8192) (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 363 ns +- 8 ns
  -> [bench_limitedstream-patch] 311 ns +- 11 ns: 1.17x faster
LimitedStream.readline(8192) (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 601 ns +- 12 ns
  -> [bench_limitedstream-patch] 308 ns +- 7 ns: 1.95x faster

Geometric mean: 1.59x faster
2023-01-05 19:26:56 +01:00
..
_ext Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
_theme Fixed docs build with sphinxcontrib-spelling 7.5.0+. 2022-05-31 11:17:01 +02:00
faq Refs #33173 -- Doc'd Python 3.11 compatibility in Django 4.1.x. 2022-10-26 20:10:33 +02:00
howto Updated various links to HTTPS and new locations. 2022-12-06 05:59:43 +01:00
internals Refs #32355 -- Bumped minimum supported versions of 3rd-party packages. 2023-01-05 18:09:33 +01:00
intro Fixed #34232 -- Fixed typo in docs/intro/tutorial07.txt. 2023-01-04 13:26:34 +01:00
man Updated man page for Django 4.1 alpha. 2022-05-17 11:21:08 +02:00
misc Fixed 32956 -- Lowercased spelling of "web" and "web framework" where appropriate. 2021-07-29 06:24:12 +02:00
ref Refs #32355 -- Bumped mysqlclient requirement to >= 1.4.3. 2023-01-05 16:34:14 +01:00
releases Fixed #33865 -- Optimized LimitedStream wrapper. 2023-01-05 19:26:56 +01:00
topics Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests. 2023-01-04 09:11:36 +01:00
conf.py Disabled auto-created table of contents entries on Sphinx 5.2+. 2022-12-29 06:07:51 +01:00
contents.txt
glossary.txt
index.txt Fixed 32956 -- Lowercased spelling of "web" and "web framework" where appropriate. 2021-07-29 06:24:12 +02:00
make.bat Added spelling option to make.bat. 2021-04-30 14:04:22 +02:00
Makefile Fixed #33753 -- Fixed docs build on Sphinx 5+. 2022-06-01 12:13:15 +02:00
README.rst
requirements.txt Bumped minimum Sphinx version to 4.5.0 in docs/requirements.txt. 2022-09-26 11:18:15 +02:00
spelling_wordlist Refs DEP 12 -- Renamed TB to Steering Council wherever mentioned. 2022-12-20 09:10:59 +01:00

The documentation in this tree is in plain text files and can be viewed using
any text file viewer.

It uses `ReST`_ (reStructuredText), and the `Sphinx`_ documentation system.
This allows it to be built into other forms for easier viewing and browsing.

To create an HTML version of the docs:

* Install Sphinx (using ``python -m pip install Sphinx`` or some other method).

* In this docs/ directory, type ``make html`` (or ``make.bat html`` on
  Windows) at a shell prompt.

The documentation in ``_build/html/index.html`` can then be viewed in a web
browser.

.. _ReST: https://docutils.sourceforge.io/rst.html
.. _Sphinx: https://www.sphinx-doc.org/