turbopipe 1.0.5__cp312-cp312-macosx_11_0_arm64.whl → 1.1.0__cp312-cp312-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of turbopipe might be problematic. Click here for more details.

turbopipe/__init__.py CHANGED
@@ -1,13 +1,13 @@
1
- from io import IOBase
1
+ from typing import Union
2
2
 
3
3
  from moderngl import Buffer
4
4
 
5
5
  from turbopipe import _turbopipe
6
6
 
7
7
 
8
- def pipe(buffer: Buffer, file: IOBase) -> None:
8
+ def pipe(buffer: Union[Buffer, memoryview], fileno: int) -> None:
9
9
  """
10
- Pipe the content of a moderngl.Buffer to a file descriptor,
10
+ Pipe the content of a moderngl.Buffer or memoryview to a file descriptor,
11
11
  Fast, threaded and non-blocking. Call `sync()` when done!
12
12
 
13
13
  Usage:
@@ -24,7 +24,10 @@ def pipe(buffer: Buffer, file: IOBase) -> None:
24
24
  turbopipe.pipe(buffer, child.stdin.fileno())
25
25
  ```
26
26
  """
27
- _turbopipe.pipe(buffer.mglo, file)
27
+ if isinstance(buffer, Buffer):
28
+ buffer = memoryview(buffer.mglo)
29
+ _turbopipe.pipe(buffer, fileno)
30
+ del buffer
28
31
 
29
32
  def sync() -> None:
30
33
  """Waits for all jobs to finish"""
Binary file
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: turbopipe
3
- Version: 1.0.5
4
- Summary: 🌀 Faster ModernGL Buffer inter process data transfers
3
+ Version: 1.1.0
4
+ Summary: 🌀 Faster MemoryView inter-process data transfers for subprocesses
5
5
  Home-page: https://brokensrc.dev
6
6
  Author-Email: Tremeschin <29046864+Tremeschin@users.noreply.github.com>
7
7
  License: MIT License
@@ -35,12 +35,18 @@ Description-Content-Type: text/markdown
35
35
 
36
36
  > [!IMPORTANT]
37
37
  > <sub>Also check out [**ShaderFlow**](https://github.com/BrokenSource/ShaderFlow), where **TurboPipe** shines! 😉</sub>
38
-
38
+ <!-- PyPI -->
39
39
  <div align="center">
40
40
  <a href="https://brokensrc.dev/"><img src="https://raw.githubusercontent.com/BrokenSource/TurboPipe/main/turbopipe/resources/images/turbopipe.png" width="200"></a>
41
41
  <h1>TurboPipe</h1>
42
+ Faster <a href="https://github.com/moderngl/moderngl"><b>ModernGL Buffers</b></a> inter-process data transfers for subprocesses
43
+ <br>
42
44
  <br>
43
- Faster <a href="https://github.com/moderngl/moderngl"><b>ModernGL</b></a> inter-process data transfers
45
+ <a href="https://pypi.org/project/turbopipe/"><img src="https://img.shields.io/pypi/v/turbopipe?label=PyPI&color=blue"></a>
46
+ <a href="https://pypi.org/project/turbopipe/"><img src="https://img.shields.io/pypi/dw/turbopipe?label=Installs&color=blue"></a>
47
+ <a href="https://github.com/BrokenSource/TurboPipe"><img src="https://img.shields.io/github/v/tag/BrokenSource/TurboPipe?label=GitHub&color=orange"></a>
48
+ <a href="https://github.com/BrokenSource/TurboPipe/stargazers"><img src="https://img.shields.io/github/stars/BrokenSource/TurboPipe?label=Stars&style=flat&color=orange"></a>
49
+ <a href="https://discord.gg/KjqvcYwRHm"><img src="https://img.shields.io/discord/1184696441298485370?label=Discord&style=flat&color=purple"></a>
44
50
  </div>
45
51
 
46
52
  <br>
@@ -53,7 +59,7 @@ The **optimizations** involved are:
53
59
 
54
60
  - **Zero-copy**: Avoid unnecessary memory copies or allocation (intermediate `buffer.read()`)
55
61
  - **C++**: The core of TurboPipe is written in C++ for speed, efficiency and low-level control
56
- - **Chunks**: Write in chunks of 4096 bytes (RAM page size), so the hardware is happy
62
+ - **Chunks**: Write in chunks of 4096 bytes (RAM page size), so the hardware is happy (Unix)
57
63
  - **Threaded**:
58
64
  - Doesn't block Python code execution, allows to render next frame
59
65
  - Decouples the main thread from the I/O thread for performance
@@ -68,7 +74,7 @@ It couldn't be easier! Just install the [**`turbopipe`**](https://pypi.org/proje
68
74
 
69
75
  ```bash
70
76
  # With pip (https://pip.pypa.io/)
71
- python -m pip install turbopipe
77
+ pip install turbopipe
72
78
 
73
79
  # With Poetry (https://python-poetry.org/)
74
80
  poetry add turbopipe
@@ -84,7 +90,7 @@ rye add turbopipe
84
90
 
85
91
  # 🚀 Usage
86
92
 
87
- See also the [**Examples**](https://github.com/BrokenSource/TurboPipe/tree/main/examples) folder for more controlled usage, and [**ShaderFlow**](https://github.com/BrokenSource/ShaderFlow/blob/main/ShaderFlow/Scene.py) usage of it!
93
+ See also the [**Examples**](https://github.com/BrokenSource/TurboPipe/tree/main/examples) folder for comparisons, and [**ShaderFlow**](https://github.com/BrokenSource/ShaderFlow/blob/main/ShaderFlow/Scene.py) usage of it!
88
94
 
89
95
  ```python
90
96
  import subprocess
@@ -106,7 +112,7 @@ ffmpeg = subprocess.Popen(
106
112
  for _ in range(60 * 60):
107
113
  turbopipe.pipe(buffer, ffmpeg.stdin.fileno())
108
114
 
109
- # Finalize writing
115
+ # Finalize writing, encoding
110
116
  turbopipe.sync()
111
117
  ffmpeg.stdin.close()
112
118
  ffmpeg.wait()
@@ -148,9 +154,9 @@ ffmpeg.wait()
148
154
  | 🐢 | Null | 1 | 882 fps | 2.44 GB/s | |
149
155
  | 🚀 | Null | 1 | 793 fps | 2.19 GB/s | -10.04% |
150
156
  | 🌀 | Null | 1 | 1911 fps | 5.28 GB/s | 116.70% |
151
- | 🐢 | Null | 4 | 880 fps | 2.43 GB/s | |
152
- | 🚀 | Null | 4 | 924 fps | 2.56 GB/s | 5.05% |
153
- | 🌀 | Null | 4 | 2037 fps | 5.63 GB/s | 131.59% |
157
+ | 🐢 | Null | 4 | 857 fps | 2.37 GB/s | |
158
+ | 🚀 | Null | 4 | 891 fps | 2.47 GB/s | 4.05% |
159
+ | 🌀 | Null | 4 | 2309 fps | 6.38 GB/s | 169.45% |
154
160
  | 🐢 | ultrafast | 4 | 714 fps | 1.98 GB/s | |
155
161
  | 🚀 | ultrafast | 4 | 670 fps | 1.85 GB/s | -6.10% |
156
162
  | 🌀 | ultrafast | 4 | 1093 fps | 3.02 GB/s | 53.13% |
@@ -166,9 +172,9 @@ ffmpeg.wait()
166
172
  | 🐢 | Null | 4 | 390 fps | 2.43 GB/s | |
167
173
  | 🚀 | Null | 4 | 391 fps | 2.43 GB/s | 0.26% |
168
174
  | 🌀 | Null | 4 | 756 fps | 4.71 GB/s | 94.01% |
169
- | 🐢 | ultrafast | 4 | 277 fps | 1.73 GB/s | |
170
- | 🚀 | ultrafast | 4 | 270 fps | 1.68 GB/s | -2.40% |
171
- | 🌀 | ultrafast | 4 | 402 fps | 2.50 GB/s | 45.32% |
175
+ | 🐢 | ultrafast | 4 | 269 fps | 1.68 GB/s | |
176
+ | 🚀 | ultrafast | 4 | 272 fps | 1.70 GB/s | 1.48% |
177
+ | 🌀 | ultrafast | 4 | 409 fps | 2.55 GB/s | 52.29% |
172
178
  | 🐢 | slow | 4 | 115 fps | 0.72 GB/s | |
173
179
  | 🚀 | slow | 4 | 118 fps | 0.74 GB/s | 3.40% |
174
180
  | 🌀 | slow | 4 | 119 fps | 0.75 GB/s | 4.34% |
@@ -178,9 +184,9 @@ ffmpeg.wait()
178
184
  | 🐢 | Null | 1 | 210 fps | 2.33 GB/s | |
179
185
  | 🚀 | Null | 1 | 239 fps | 2.64 GB/s | 13.84% |
180
186
  | 🌀 | Null | 1 | 534 fps | 5.91 GB/s | 154.32% |
181
- | 🐢 | Null | 4 | 233 fps | 2.58 GB/s | |
182
- | 🚀 | Null | 4 | 232 fps | 2.57 GB/s | -0.08% |
183
- | 🌀 | Null | 4 | 495 fps | 5.48 GB/s | 112.64% |
187
+ | 🐢 | Null | 4 | 219 fps | 2.43 GB/s | |
188
+ | 🚀 | Null | 4 | 231 fps | 2.56 GB/s | 5.64% |
189
+ | 🌀 | Null | 4 | 503 fps | 5.56 GB/s | 129.75% |
184
190
  | 🐢 | ultrafast | 4 | 141 fps | 1.56 GB/s | |
185
191
  | 🚀 | ultrafast | 4 | 150 fps | 1.67 GB/s | 6.92% |
186
192
  | 🌀 | ultrafast | 4 | 226 fps | 2.50 GB/s | 60.37% |
@@ -360,9 +366,7 @@ On realistically loads, like [**ShaderFlow**](https://github.com/BrokenSource/Sh
360
366
 
361
367
  # 📚 Future work
362
368
 
363
- - Add support for NumPy arrays, memoryviews, and byte-like objects
364
369
  - Disable/investigate performance degradation on Windows iGPUs
365
370
  - Improve the thread synchronization and/or use a ThreadPool
366
- - Stabler way for finding mglo struct offsets (moderngl.h?)
367
371
  - Maybe use `mmap` instead of chunks writing on Linux
368
- - Test on MacOS 🙈
372
+ - Test on macOS 🙈
@@ -0,0 +1,6 @@
1
+ turbopipe/_turbopipe.cpython-312-darwin.so,sha256=sCaZOFrPYgr5UOTY-pC00QPHJpQ5JLxkPoDaJ6284jc,76768
2
+ turbopipe/__init__.py,sha256=vDOOrpFDLHBpftUk1Jr-QoRd1lOLkhg-0kRvHUAyArk,1043
3
+ turbopipe-1.1.0.dist-info/License.md,sha256=it5BPGKEP68XuUE54o2wVWR8NeWowkvb5dQO62UPeo8,1075
4
+ turbopipe-1.1.0.dist-info/RECORD,,
5
+ turbopipe-1.1.0.dist-info/WHEEL,sha256=BlgdoGd2KNVEkPyD8Qw7I04Bd9Sa0Eb3ERRi6yJxIis,93
6
+ turbopipe-1.1.0.dist-info/METADATA,sha256=lKFUmRKCCjpY1gaAG4_WuqTKoaUZFKN0JQeSIkfvlLg,21716
@@ -1,6 +0,0 @@
1
- turbopipe/_turbopipe.cpython-312-darwin.so,sha256=gtW88br0tpJnfGnwuPlHNGz_srF91Zc2G2MlNB_cZxM,126736
2
- turbopipe/__init__.py,sha256=M8IwBGd_kGaL8JEUygsg_w_m1QWT7O9r0ImCvVjTAko,920
3
- turbopipe-1.0.5.dist-info/License.md,sha256=it5BPGKEP68XuUE54o2wVWR8NeWowkvb5dQO62UPeo8,1075
4
- turbopipe-1.0.5.dist-info/RECORD,,
5
- turbopipe-1.0.5.dist-info/WHEEL,sha256=BlgdoGd2KNVEkPyD8Qw7I04Bd9Sa0Eb3ERRi6yJxIis,93
6
- turbopipe-1.0.5.dist-info/METADATA,sha256=KNejWjLOZR3PVK7pyoKv8Y4Glm2qvDFJjBRVX8Df-0c,21054