Skip to content

Commit b6f89ba

Browse files
authored
minor fixes
1 parent 6e8f8de commit b6f89ba

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎doc/optimize_python.rst‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ does not scale for parallelism with multithreading.
2727

2828
A tracing and moving garbage collector would be more efficient. The garbage
2929
collection could be done in multiple steps in separated thread rather than
30-
having long delays causing by the CPython blocking stop-the-world gabage
30+
having long delays causing by the CPython blocking stop-the-world garbage
3131
collector.
3232

33-
The ability to deference pointers like ``PyObject*`` make the implementation
34-
of a moving gabarge collector more complicated. Only using handles would make
33+
The ability to deference pointers like ``PyObject*`` makes the implementation
34+
of a moving garbarge collector more complicated. Only using handles would make
3535
the implementation simpler.
3636

3737
Run Python threads in parallel
@@ -42,7 +42,7 @@ of the C API. The GIL has many convenient advantages to simplify the
4242
implementation. But it basically limits CPython to a single thread to run
4343
CPU-bound workload distributed in multiple threads.
4444

45-
Per-object locks would allow to help to scale threads on multiple threads.
45+
Per-object locks would allow to help scaling threads on multiple CPU.
4646

4747
More efficient data structures (boxing/unboxing)
4848
------------------------------------------------
@@ -71,28 +71,28 @@ member and so requires ``PyTupleObject`` to only store ``PyObject*`` objects.
7171

7272

7373
The C API should be modified to abstract accesses to objects through function
74-
calls rather than using macros which access directly to structure members.
74+
calls rather than using macros which access directly structure members.
7575

7676
Structures must be excluded from the public C API: become "opaque".
7777

7878
PyObject* type can be dereferenced (use handles)
7979
------------------------------------------------
8080

81-
Since structures a public, it is possible to deference pointers to access
81+
Since structures are public, it is possible to deference pointers to access
8282
structure members. For example, access directly to ``PyObject.ob_type`` member
8383
from a ``PyObject*`` pointer, or access directly to
8484
``PyTupleObject.ob_type[index]`` from a ``PyTupleObject*`` pointer.
8585

86-
Using opaque **handles** like HPy what does would prevent that.
86+
Using opaque **handles** like HPy does would prevent that.
8787

8888
Borrowed references (avoid them)
8989
--------------------------------
9090

91-
Many C API functions like ``PyDict_GetItem()`` or ``PyTuple_GetItem()`` return
92-
a borrowed references. They make the assumption that all objects are actual
91+
Many C API functions like ``PyDict_GetItem()`` or ``PyTuple_GetItem()`` return
92+
a borrowed reference. They make the assumption that all objects are actual
9393
objects. For example, if tagged pointers are implemented, a ``PyObject*`` does
9494
not point to a concrete object: the value must be boxed to get a ``PyObject*``.
95-
The problem with borrowed references is to decide when it is safe to destroy
95+
The problem with borrowed reference is to decide when it is safe to destroy
9696
the temporary ``PyObject*`` object. One heuristic is to consider that it must
9797
remain alive as long as its container (ex: a list) remains alive.
9898

@@ -140,4 +140,4 @@ similar issue. Example: ``&PyTuple_GET_ITEM()`` is used to get
140140

141141
The ``PyObject_GetBuffer()`` is a sane API: it requires the caller to call
142142
``PuBuffer_Release()`` to release the ``Py_buffer`` object. Memory can be
143-
copied if needed to allow to move the object while the buffer is used.
143+
copied if needed to allow moving the object while the buffer is used.

0 commit comments

Comments
 (0)