pybind / pybind/pybind11

PyBind11 Slow Performance

Open
#3,031 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

Hi,

I have some c++ code that I want to call from Python, and I followed this guide. However, I was surprised to see the performance of PyBind11 to be slower than not only the CPython implementation but also the vanilla Python performance. (See image attached below for runtimes)
image

I guess I'm a bit confused, I don't really know if it's something on my side which is causing the PyBind11 to run very slowly, any guidance to point me in the right direction to finding the source of this would be helpful. I followed the guide step by step.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report provides only the Visual Studio C++/Python guide and an attached runtime image, with no repository file, test, or reproducible example. Start by reducing the comparison to a minimal PyBind11 benchmark and documenting the build and timing conditions; done means an isolated, reproducible cause or a clearly actionable report.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.