From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 0F4AE1F4BD for ; Tue, 8 Oct 2019 17:56:04 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 58EC7120A39; Wed, 9 Oct 2019 02:55:42 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1D877120A38 for ; Wed, 9 Oct 2019 02:55:39 +0900 (JST) Received: by filter0148p3mdw1.sendgrid.net with SMTP id filter0148p3mdw1-24085-5D9CCD9E-16 2019-10-08 17:55:42.120261716 +0000 UTC m=+90183.537206268 Received: from herokuapp.com (unknown [54.157.57.165]) by ismtpd0054p1mdw1.sendgrid.net (SG) with ESMTP id 70lsb0AjQ5m1edGQO2zLBg for ; Tue, 08 Oct 2019 17:55:41.933 +0000 (UTC) Date: Tue, 08 Oct 2019 17:55:42 +0000 (UTC) From: shevegen@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70868 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16245 X-Redmine-Issue-Author: sam.saffron X-Redmine-Sender: shevegen X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?6lbdtOg4RDRLuxD00eQtQKgoNAsge5d4xND7cbMQd0xQuQBrg57M928MaT9sUm?= =?us-ascii?Q?fpp6KVd=2FrT1hPHX7fdTmD1=2FjRD31MM476e=2FoypN?= =?us-ascii?Q?OqRfMHnSvZd9QOxS2d0qoUtDZKJIVmLlD8j5H0t?= =?us-ascii?Q?1e6vcjyD5h33askBwb0M+p3NgYYCz6gP5s8KgbY?= =?us-ascii?Q?DQ+GSCV=2FfAgXm=2F=2FtYuy+p3VKakkovBYhhdw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95281 Subject: [ruby-core:95281] [Ruby master Feature#16245] Add interfaces to count and measure size all IMEMO objects X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16245 has been updated by shevegen (Robert A. Heiler). Personally I love introspection so I am all in favour of giving ruby people lots of tools to play with internal. I also liked oldschool evi.rb. :) I guess this is for koichi to comment e. g. how stable he considers the gem/code; and possibly also whether the API is wanted in the first place. And perhaps also whether the name iseq is already an official name or not, ruby-internal wise (I really don't know, just pointing that out). As for the name **NonMaterializedInstructionSequences** - I think that name is too long and complicated. Ideally accessing should be simple, whenever possible, in my opinion. I am not even sure what a "non-materialized instruction sequence" is - is that ruby's version of a monoid-endofunctor monad? IMO, simpler names would be better. Although I guess if the functionality is what matters, then I guess we may agree that the functionality can be useful. methodmissing wrote: > I understand the API proposal, but also I believe the intention was for these > objects to be internal and not necessarily to be exposed through API. Yeah, I think I have read similar discussions in the past, also comments made by matz, koichi and shyouhei, in a different context. Which I guess makes sense too - less exposure may mean less problems. I am also neutral about the proposal really, don't mind either way - guess it may be for sam to reason in favour of it. :-) Even then, though, I love introspection in general. Ruby is like a closed box initially, just like on xmas (and the xmas release), and you get the tools to poke inside and try to find out how it works! \o/ Perhaps if it may help the discussion (not that I contribute much to it), there could be a discussion for potential problems in this regard, e. g. pitfalls, problems etc... or it may remain a separate gem, and it may be evaluated how useful it may be to integrate it into ruby directly. That discussion has also happened with other code elements / gems in the past, e. g. martin duerst pointed this out a few times before. But as said, I am really neutral either way here. ---------------------------------------- Feature #16245: Add interfaces to count and measure size all IMEMO objects https://bugs.ruby-lang.org/issues/16245#change-81959 * Author: sam.saffron (Sam Saffron) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Koichi introduced an experimental gem: https://github.com/ko1/iseq_collector It allows: ObjectSpace.each_iseq{|iseq| ...} ObjectSpace.count_iseq #=> Integer ObjectSpace.memsize_of_all_iseq (should not generate RubyVM::InstructionSequence wrappers for IMEMOs) Since the wrapper object RubyVM::InstructionSequence is lazily allocated, ObjectSpace.each_object does not find these IMEMOs unless they have been wrapped. This design is good and conserves memory. `count_iseq` and `memsize_of_all_iseq` are very powerful metrics most large Ruby deployments can use to automatically detect method leaks introduced via meta programming. These issues are invisible now short of walking a heap dump. Can we add the new interface into 2.7? -- https://bugs.ruby-lang.org/