From: "mame (Yusuke Endoh) via ruby-core" Date: 2023-03-10T03:32:52+00:00 Subject: [ruby-core:112819] [Ruby master Feature#19452] `Thread::Backtrace::Location` should have column information if possible. Issue #19452 has been updated by mame (Yusuke Endoh). Thank you all! kddeisz (Kevin Newton) wrote in #note-8: > In terms of memory consumption, I would think it would be 1-to-1 if we dropped node_id and replaced it with column What concerns me slightly is that it makes it impossible to uniquely identify nodes that have the same column information, such as NODE_SCOPE or its child node. Perhaps it is not a very big deal for ErrorHighlight, though. Eregon (Benoit Daloze) wrote in #note-9: > I think we should measure, e.g. by how much % does it increase the memory of a Ruby program and a Rails app? > I suspect it's not much higher than keeping the node id. When adding node_id, I evaluated the memory usage with `rails s`. (See #17930.) It increased about 3 % (97 MB -> 100 MB). Not very small to ignore. ufuk (Ufuk Kayserilioglu) wrote in #note-11: > could we not store line/column information as varints That makes sense. Although some efforts have already been made in compression, I guess that there would be room for improvement. ---------------------------------------- Feature #19452: `Thread::Backtrace::Location` should have column information if possible. https://bugs.ruby-lang.org/issues/19452#change-102326 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal ---------------------------------------- I discussed this with @mame and it would be pretty useful if we could also get the column information from exception backtrace location, even if it was slow. A POC: ```ruby class Thread::Backtrace::Location if defined?(RubyVM::AbstractSyntaxTree) def first_column RubyVM::AbstractSyntaxTree.of(self, keep_script_lines: true).first_column end else def first_column raise NotImplementedError end end end ``` It would be good to have a standard interface, so we follow the same interface as https://bugs.ruby-lang.org/issues/19451 and vice versa where it makes sense. I'll investigate it. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/