Skip to content

Commit

Permalink
Fixed various spelling and grammar mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
SomedudeX committed May 4, 2024
1 parent e0661fc commit 7be5e43
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api_reference/integer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This file contains an overview and documentation for the `vint::Int` class. It i

## Details

The `vint::Int` class is an arbitrary precision integer type, capable of storing and manipulating numbers larger than an unsigned 64-bit integer. Just like regular integers, they behave like them and support all arithmetic operations as well as math functions. However unlike built-in integers, they start at the 32-bit size and can dynamically grow and shrink to store and represent larger integers.
The `vint::Int` class is an arbitrary precision integer type, capable of storing and manipulating numbers larger than an unsigned 64-bit integer. Just like regular integers, they behave like them and support all arithmetic operations as well as math functions. However, unlike built-in integers, they start at the 32-bit size and can dynamically grow and shrink to store and represent larger integers.

Internally, it is implemented similar to Python's int object. The integer itself is stored in base 2<sup>32</sup> in a vector of `uint32_t` , where each element in the vector represents a digit. Similar to the base-10 integer system, we can add another place value by appending an element at the end of the vector when necessary. We can then "carry" the overflow into this new element, allowing for the expansion of the integer representation.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For an overview of some basic information of this library to get you started, ch

## Quickstart

The following tutorial will install and setup the vint library in a CMake project as well as demonstrate basic examples and usages of this library. Make sure you have both CMake and Make installed and on your path before continuing. At least c++11 is required to compile vint.
The following tutorial will install and set up the vint library in a CMake project as well as demonstrate basic examples and usages of this library. Make sure you have both CMake and Make installed and on your path before continuing. At least c++11 is required to compile vint.

* Add the library as a git submodule

Expand Down
22 changes: 11 additions & 11 deletions docs/pages/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@ add_end = time.perf_counter_ns()
print(f"Addition took {(add_end - add_beg) / 1000:.0f}ms")
```

The following chart shows the performance difference between the vint library and Python's int object when N grows. To ensure that no performance has been lost from real time interpreting, the Python script has been saved on disk and therefore compiled into bytecode before its run. The right most column showcases the performance difference between vint library and Python in percentage (e.g. `+55%` means that the vint library is 55% faster than Python). Note the time shown is an winsorized average of 5 test runs.
The following chart shows the performance difference between the vint library and Python's int object when N grows. To ensure that no performance has been lost from real time interpreting, the Python script has been saved on disk and therefore compiled into bytecode before its run. The right most column showcases the performance difference between vint library and Python in percentage (e.g. `+55%` means that the vint library is 55% faster than Python). Note the time shown is a winsorized average of 5 test runs.

| N | Vint addition | Python addition | Difference |
| N | Vint addition | Python addition | Difference |
|:----------|-----------------:|-------------------:|-------------:|
| 1,000 | 56μs | 82μs | +46% |
| 10,000 | 1,909µs | 2,517µs | +31% |
| 100,000 | 141ms | 177ms | +26% |
| 1,000,000 | 14,188ms | 17,474ms | +23% |
| 1,000 | 56μs | 82μs | +46% |
| 10,000 | 1,909µs | 2,517µs | +31% |
| 100,000 | 141ms | 177ms | +26% |
| 1,000,000 | 14,188ms | 17,474ms | +23% |

## Conversion Performance

Because conversion to string is the only way to print without integer overflow in c++, the conversion performance will be focused on only integer to string conversion. We can use the `to_string()` methods for vint or the `str()` function for Python. The following chart shows the performance differences between vint and Python in conversion from integer to string type. The leftmost column depicts the numbers of digits in base-10 that the number has:

| Digits | Vint addition | Python addition | Difference |
| Digits | Vint addition | Python addition | Difference |
|:----------|-----------------:|-------------------:|-------------:|
| 300 | 54μs | 2μs | -27.00x |
| 3,000 | 3,314μs | 123μs | -26.94x |
| 30,000 | 309ms | 8ms | -38.62x |
| 300,000 | 35,341ms | 29ms | -1218.65x |
| 300 | 54μs | 2μs | -27.00x |
| 3,000 | 3,314μs | 123μs | -26.94x |
| 30,000 | 309ms | 8ms | -38.62x |
| 300,000 | 35,341ms | 29ms | -1218.65x |

As one can tell, vint's integer to string conversion function is exponentially slower than Python's implementation. This is one area (who knew) that vint could improve.

0 comments on commit 7be5e43

Please sign in to comment.