V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
csysly123
V2EX  ›  Python

新手,请教一个问题

  •  
  •   csysly123 · 2019-10-16 21:38:38 +08:00 · 2663 次点击
    这是一个创建于 1625 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我有一张图片,然后要把图片的每个像素调用同一个函数进行加密运算(每个像素加密过程独立),现在是采用循环顺序对每个像素进行处理,感觉这样效率太低了,有没有办法可以让多个像素并行处理,提高处理效率。。
    4 条回复    2019-10-20 22:47:18 +08:00
    arrow8899
        1
    arrow8899  
       2019-10-16 22:06:37 +08:00
    多线程 or 多进程? python 的话有 numpy 可以用,还是慢的话可以用 GPU 来跑。
    aaronhua
        2
    aaronhua  
       2019-10-17 00:10:25 +08:00
    cython 可以么
    laravel
        3
    laravel  
       2019-10-17 15:50:47 +08:00
    把像素们分块儿,让多个线程 /进程 /协程并发处理
    necomancer
        4
    necomancer  
       2019-10-20 22:47:18 +08:00
    1. 尽量使用数学语言表达,然后用带 mkl 的 numpy,例如 anaconda;
    2. numba.njit
    3. numba.cuda.jit
    4. cython openmp
    5. multiprocessing
    6. pp
    ....
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5260 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:22 · PVG 17:22 · LAX 02:22 · JFK 05:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.