Changes

Jump to: navigation, search

GEPS 016: Enhancing Gramps Processing Speed

1,161 bytes added, 11:03, 16 January 2020
Profiling
=== Importing ===
See a discussion on [http://sourceforge.net/mailarchive/message.php?msg_id=23743446 Glacial imports(2009)].
A gzipped profile log of importing a gramps file: [[Media:Profile-log-of-importing-a-gramps-file.zip]]
<pre>
python /usr/lib/python2.7/cProfile.py -o profile-log src/gramps.py -i ~/Desktop/import-test.gramps
</pre>
or
<pre>
python3 /usr/lib/python3.4/profile.py -o profile-log Gramps.py -i ~/example/gramps/data.gramps
</pre>
To interpret the stats, you must realize that the function calls reflect a hierarchical structure. This src/gramps.py uses the most time as it is the topmost program. So, you may have to go down quite a ways to see the lower-level functions that are actually responsible for the processing. For example, '''/home/dblank/gramps/trunk/src/gen/db/write.py:1349(commit_base)''' may be a function that could be speed up.
 
===Testing one module===
 
An alternative to make a profile on a gramps session is to test one section of an existing module.
 
<pre>import cProfile
pr = cProfile.Profile()
pr.enable()
# your code here
pr.disable()
pr.print_stats(sort='time')</pre>
 
====Additionnal tips====
 
python
>>> import hotshot, hotshot.stats, test.pystone
>>> stats = hotshot.stats.load('profile-log')
>>> stats.strip_dirs()
>>> stats.sort_stats('time', 'calls')
>>> stats.print_stats(200)
>>> stats.sort_stats('cumulative', 'calls')
>>> stats.print_stats(200)
>>> stats.sort_stats('calls')
>>> stats.print_stats(200)
>>> stats.sort_stats('ncalls', 'calls')
>>> stats.print_stats(200)
>>> stats.sort_stats('pcalls', 'calls')
>>> stats.print_stats(200)
=== Profile GUI ===
For exploring furthereasier, you can also try some tools like [http://www.vrplumber.com/programming/runsnakerun/ RunSnakeRun].
[[ImageFile:RunSnakeRun_profile.png|thumb|right|400px450px|RunSnakeRun with Gramps profile loaded]][[File:RunSnakeRun1.png|thumb|right|450px|RunSnakeRun Navigation]][[File:RunSnakeRun2.png|thumb|right|450px|RunSnakeRun Navigation (top level)]]
{{-}}
=== Profile Links ===
* [[Debugging_Gramps#Use_profiling|Debugging]] - some notes on profiling Gramps* [http://docs.python.org/library/profile.htmlThe Python Profilers] - Python's profiling documentation* [https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Profiling_Code Profiling Code Tips].- PythonSpeed/PerformanceTips - Python Wiki
== Patches and Fixes ==
* Bug#{{bug|4304}} Pedigree gramplet - Resolved 2011-02-18
* Bug#{{bug|4428}} XML import - Resolved 2011-01-25 rev16449/50
* Bug#{{bug|8144}} Uncollected Objects and profiles - ''pendingClosed 2016'' ==See also==* [[Gramps Performance]]
== Links External links ==
* [http://wiki.python.org/moin/PythonSpeed Python speed]
[[Category:GEPS|E]]

Navigation menu