Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit ca731bf

Browse files
Merge pull request numba#3944 from esc/fixup_jitclass_docs
Fixup jitclass docs
2 parents 6654726 + 2ec82d9 commit ca731bf

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/source/user/jitclass.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _jitclass:
22

3-
=======================================
4-
Compiling python classes with @jitclass
5-
=======================================
3+
===========================================
4+
Compiling Python classes with ``@jitclass``
5+
===========================================
66

77
.. note::
88

@@ -13,7 +13,7 @@ Compiling python classes with @jitclass
1313
Numba supports code generation for classes via the :func:`numba.jitclass`
1414
decorator. A class can be marked for optimization using this decorator along
1515
with a specification of the types of each field. We call the resulting class
16-
object a jitclass. All methods of a jitclass are compiled into nopython
16+
object a *jitclass*. All methods of a jitclass are compiled into nopython
1717
functions. The data of a jitclass instance is allocated on the heap as a
1818
C-compatible structure so that any compiled functions can have direct access
1919
to the underlying data, bypassing the interpreter.
@@ -52,8 +52,8 @@ Here's an example of a jitclass::
5252
(see full example at `examples/jitclass.py` from the source tree)
5353

5454
In the above example, a ``spec`` is provided as a list of 2-tuples. The tuples
55-
contain the name of the field and the numba type of the field. Alternatively,
56-
user can use a dictionary (an ``OrderedDict`` preferrably for stable field
55+
contain the name of the field and the Numba type of the field. Alternatively,
56+
user can use a dictionary (an ``OrderedDict`` preferably for stable field
5757
ordering), which maps field names to types.
5858

5959
The definition of the class requires at least a ``__init__`` method for
@@ -65,21 +65,21 @@ automatically compiled.
6565
Support operations
6666
==================
6767

68-
The following operations of jitclasses work in both the interpreter and numba
68+
The following operations of jitclasses work in both the interpreter and Numba
6969
compiled functions:
7070

7171
* calling the jitclass class object to construct a new instance
7272
(e.g. ``mybag = Bag(123)``);
7373
* read/write access to attributes and properties (e.g. ``mybag.value``);
7474
* calling methods (e.g. ``mybag.increment(3)``);
7575

76-
Using jitclasses in numba compiled function is more efficient.
76+
Using jitclasses in Numba compiled function is more efficient.
7777
Short methods can be inlined (at the discretion of LLVM inliner).
7878
Attributes access are simply reading from a C structure.
7979
Using jitclasses from the intpreter has the same overhead of calling any
80-
numba compiled function from the interpreter. Arguments and return values
81-
must be unboxed or boxed between python objects and native representation.
82-
Values encapsulated by a jitclass does not get boxed into python object when
80+
Numba compiled function from the interpreter. Arguments and return values
81+
must be unboxed or boxed between Python objects and native representation.
82+
Values encapsulated by a jitclass does not get boxed into Python object when
8383
the jitclass instance is handed to the interpreter. It is during attribute
8484
access to the field values that they are boxed.
8585

@@ -88,7 +88,7 @@ Limitations
8888
===========
8989

9090
* A jitclass class object is treated as a function (the constructor) inside
91-
a numba compiled function.
91+
a Numba compiled function.
9292
* ``isinstance()`` only works in the interpreter.
9393
* Manipulating jitclass instances in the interpreter is not optimized, yet.
9494
* Support for jitclasses are available on CPU only.

0 commit comments

Comments
 (0)