Python 高速memcpy

Python high speed memcpy

我正在尝试在 Python 中执行高速 memcpy。我使用允许我与 C 程序交互的 ctypes 库。

我按照以下步骤操作:

  1. 我得到了内存地址
  2. 我得到了数据的长度
  3. 我使用 ctypes 的函数 memmove 或 string_at

结果正确,但我需要更高的速度。有没有不使用 C 的更快的方法来做到这一点?

谢谢。

我在这个 post 中找到了一个解决方案:

How to read from pointer address in Python?

在Hannah Zhang的回答中。