Python 高速 memcpy

标签 python c memory-management ctypes high-speed-computing

我正在尝试用Python 进行高速memcpy。我使用 ctypes 库,它允许我与 C 程序交互。

我按照以下步骤操作:

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

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

谢谢。

最佳答案

我在这篇文章中找到了一个解决方案:

How to read from pointer address in Python?

汉娜·张的回答。

关于Python 高速 memcpy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60056485/

相关文章:

c++ - new什么时候分配内存?

python - 识别正在传输 icmp 数据包的进程的 PID

Python Multiprocessing - 修改共享字典中的值

python - 用于伊辛模型的 python 中的嵌套循环

c - NetBeans 导航器窗口为空

c - 通过 C 中的几个函数传递结构?

android - Android是否支持虚拟内存

python - 在 Python Pandas Dataframe 中动态添加列的数据处理

结构指针地址比较不起作用

c++ - 可以在堆上创建的对象在 C++ 中被视为 'being on stack' 吗?