Changes

Jump to: navigation, search

GEPS 016: Enhancing Gramps Processing Speed

1,537 bytes added, 11:03, 16 January 2020
Profiling
''This is a GEP for examining, detailing, and proposing enhancements to address speed issues in GRAMPSGramps.''
= Enhancing Speed Workflow =
The first step in working toward speeding up GRAMPS Gramps is to identify particular functions or activities that take more time than you would like.
The next is to examine in detail what functions are the bottle-necks in the processing. This is most easily and scientifically done through Python's Profiling tools.
=== Importing ===
See a discussion on [http://wwwsourceforge.nabble.comnet/mailarchive/Glacial-imports-ts25873548message.html php?msg_id=23743446 Glacial imports(2009)].
A gzipped profile log of importing a gramps file: [[Media:profileProfile-import.log-of-importing-a-gramps-file.zip]]
== Profiling ==
<pre>
python /usr/lib/python2.67/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>
</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 sped 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 cProfilepr = cProfile.Profile()pr.enable()# your code herepr.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 easier, you can also try some tools like [http://www.vrplumber.com/programming/runsnakerun/ RunSnakeRun]. [[File:RunSnakeRun_profile.png|thumb|right|450px|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_GRAMPSDebugging_Gramps#Use_profiling|Debugging]] - some notes on profiling GRAMPSGramps* [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 ==
* [http://www.gramps-project.org/bugs/view.php?id=4304 Bug #{{bug|4304: }} Pedigree gramplet]- Resolved 2011-02-18* [http://www.gramps-project.org/bugs/view.php?id=4428 Bug #{{bug|4428 }} XML import- Resolved 2011-01-25 rev16449/50* Bug#{{bug|8144}} Uncollected Objects and profiles - ''Closed 2016'' ==See also==* [[Gramps Performance]]
== Links External links ==
* [http://wiki.python.org/moin/PythonSpeed Python speed]
[[Category:GEPS|E]]

Navigation menu