How to speed up the python side's access to C++ side std::vector<T> #4962
Unanswered
LeBron-Jian
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Firstly, I create a function Dataset which takes a std::vector as input, and i would like to expose the function to python, The function is constructed as follows
When I store a large amount of data, the speed is a bit slow when I access imgs, ids or labels of a certain index on the python side, especially imgs and labels.
For example, I try to call like this
I tried to use the next code in C++ to speed
and also try to use next code to speed
and this code
However, the access speed is higher, not as fast as the original.
But in fact, when the amount of data is very large, such as 100,000 or 200,000, accessing the original std::vector on the C++ side through index is slower, so I would like to ask if there is anything I can do Any way to optimize speed?
Beta Was this translation helpful? Give feedback.
All reactions