- For system specs see here
- These would be a series of posts…as it is realised that the reason for regressions are very much common across bms.
NOTE: For better visualization of what is described below install Kcahegrind and than do
kcachegrind file-name and for files look here (the ones with * *callgrind suffix* *)
The different way of initialisation:
NOTE:All percentages are of corresponding startup-time which are:(obtained using
perf module here)
| Benchmark | py2 | py3 | +————————-+———-+——————————-+ | python_startup | 19.2 ms | 42.3 ms: 2.21x slower (+121%) | +————————-+———-+——————————-+
For both py2(always 2.7) & py3(always 3.7) start with
Py_Main but the initialisation is different in both->
Py_InitializeEx$ py3: -
initsite[6.07%](there are calls to other functions and error checking that takes rest of time $ )
- `Py_FinalizeEx`[6.25%]\(This function does the cleanup job by calling `PyImport_Cleanup` (which empties the module table it). *The way of cleaning things is different from py2* \)
PyRun_AnyFileExFlags[91.81%]( It can run any-interactive console or normal file and in our case it simply calls
PyRun_FileExFlagseventually) it than calls
py3: - `run_file`[77.42%] than calls `PyRun_AnyFileExFlags` and finally `run_mod`[$](https://gist.github.com/bhavishyagopesh/0dd58cdf9171ea33f7b7872a513b64a7) (here it uses **Py_Object** as compared to py2's **const char\*** --*optimization oppurtunity maybe* )and now the functions involving `AST` and `encoding` are called.
- I have added
gists[$] for relevant function declaration.
- Remaining steps will be covered in next post.