Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Most Efficient Internal Representation of Matrices #14
Comments
Hi, I don't think array it the best solution for this project. I think the best solution is we have to write a new extension and store our matrix using fixed-size C++ array, and all of elements of this array should be the same type. As I remember that the numpy loop with nditer is faster 10 times that native python loop, because it run on C++ instead of python. PHP using HashTable for storing array so it not really efficiency |
Hello @rickynguyen |
Just do some researching about how PHP7 optimized their array. I see that they store zval inside Hashtable instead of pointer like PHP5 before. Right now I think you has chosen the right way..! |
In an email with @GordonLesti , the topic of efficient internal representation of matrices was discussed. There were concerns about the current approach of using nested arrays. The other alternative is to store one single array, and store another variable for the shape of the matrix. Currently I am researching which would be optimal.
I know you had mentioned that in some cases the nested array performed better and in other cases the single array representation performed better. Do you happen to remember or have it documented which operations were most efficient with which representation? That would be helpful information. I can generate new benchmarks if needed, but trying to save that step.
As I gain more insight into this, I will update this thread with relevant information and proposals. Thanks.