Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006302OCamlruntime system and C interfacepublic2014-01-22 10:512015-12-11 19:26
Assigned Tojacques-henri.jourdan 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.02.0+dev 
Summary0006302: Very slow backtraces in bytecode : debug infos read from the filesystem everytime
DescriptionThe function read_debug_info() in byterun/backtrace.c is called every time a backtrace is requested.

Recently, we wanted to log backtraces in one piece of the program and it became extremely slow in bytecode. The .cds file has about 40Mb, and it takes about 0.5s to read it.

What's the rationale for re-reading debug infos every time instead of keeping it in memory?

If it's considered problematic to keep the data in RAM (esp. considering it can be so large), we could have at least have an option to do so, or maybe consider using a more compact representation for location information required for backtraces. Currently, we use debug events, which are much richer than what we need (only their ev_pos and ev_loc fields). We could project debug events to these two fields either upon reading the debugging info in backtrace.c, or maybe have this more compact data stored as a different section in the bytecode/.cds file to optimize reading it.
TagsNo tags attached.
Attached Files

- Relationships
related to 0005899closedjacques-henri.jourdan Expose a way to inspect the current call stack 

-  Notes
gasche (administrator)
2014-01-24 15:36

Indeed, I think keeping only the ev_pos and ev_loc of the "events" structure and keeping that in memory should be unproblematic. I had never noticed that event_for_location does a linear search in the event list, do you think that could also be a performance issue for backtrace-heavy applications?
frisch (developer)
2014-03-28 10:46

The problem is addressed in the patch patch_backtraces.diff attached to 0005899.
gasche (administrator)
2014-05-10 21:39

The fix was merged in trunk.

- Issue History
Date Modified Username Field Change
2014-01-22 10:51 frisch New Issue
2014-01-22 10:54 frisch Summary Very flow backtrace in bytecode : debug infos read from the filesystem everytime => Very slow backtraces in bytecode : debug infos read from the filesystem everytime
2014-01-22 10:54 frisch Description Updated View Revisions
2014-01-24 15:36 gasche Note Added: 0010844
2014-03-28 10:45 frisch Relationship added related to 0005899
2014-03-28 10:46 frisch Note Added: 0011124
2014-05-10 21:39 gasche Note Added: 0011418
2014-05-10 21:39 gasche Status new => resolved
2014-05-10 21:39 gasche Fixed in Version => 4.02.0+dev
2014-05-10 21:39 gasche Resolution open => fixed
2014-05-10 21:39 gasche Assigned To => jacques-henri.jourdan
2015-12-11 19:26 xleroy Status resolved => closed
2017-02-23 16:43 doligez Category OCaml runtime system => runtime system
2017-03-03 17:45 doligez Category runtime system => runtime system and C interface

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker