Best practice for the Python-then-profile-then-C design pattern? -
Looks like a popular software development pattern:
- Expose logic and algorithms Python
- Profile to know where to go for slow bits.
- Change those people with C
- Ship code that is high-level and fast
I say popular because I have seen people as a great idea about it.
But are there any major projects that actually used this method? Maybe free software projects so I can put a look and see how they did it - and perhaps learn some best practices.
There are many different ways that people are in the approach of development Sometimes people Follow the three steps and find that the slow bits are due to the external environment, so typing Python in C does not solve the problem. The type of slow motion can sometimes be solved on the system, and Sometimes it can be solved in Python by applying a different algorithm. For example, you can cache network responses so that you do not need to go to the network every time, or in SQL you can offload work in `stored procedures that run on the server and reduce the size of the results set Are there. Normally, when you have something that needs to be rewritten in C, the first thing is to search the library already present and create a Python Cover, if someone is not already present. There is often to beat the application architecture in step 1, doubt that in some areas there may be a display problem, then select the C library (probably already wrapped). For Python) and use it, then in Step 2 it is confirmed that there really are no major display problems which need attention. I would say that it would be better to guess and try to reduce performance barriers for a team with one or more experienced developers, with the existing module already already in place. If you are starting with a dragon, then your 3-step process is fully valid, i.e. get the construction and test code, knowing that there is a possibility of a profiler and a fast Module if you need it and then a There are psycho and various tools to freeze an application in binary executable. If you know that you will need to use some C or C ++ modules, then this is an alternative approach, starting from scratch to writing applications in C but dragon has to work most Embed for This works well for experienced C or C + + developers because they have a big idea of a type of code which is hard to do in C.
Comments
Post a Comment