From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 39CF81A00A08 for ; Tue, 29 Mar 2016 18:16:16 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 92F63B5D8D5 for ; Tue, 29 Mar 2016 18:53:03 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id F240118CC7E8 for ; Tue, 29 Mar 2016 18:53:03 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 025091204EC; Tue, 29 Mar 2016 18:53:03 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id DF1401204B9 for ; Tue, 29 Mar 2016 18:52:59 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=qSxSP9n/hes0pnmVECifhjH0TP0=; b=xY1cuIFJnT/eUrPRlp 9pY8u7tOXEihvu3wc3jRdty6gNm6Dt2FAcUIr3lF3ezFm9aGQhAcSqHC3doU9HdI EkZs8Fh34SBFYQvKr/Qkbvfn0pAO+TwKfSF+NEuLl/az0t3Iyo3d0Z1+Et8OzxED VtAF5b/7YE9nTDJbWAcd/4qUA= Received: by filter0870p1mdw1.sendgrid.net with SMTP id filter0870p1mdw1.2761.56FA50781B 2016-03-29 09:52:56.608131746 +0000 UTC Received: from herokuapp.com (ec2-54-225-10-96.compute-1.amazonaws.com [54.225.10.96]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id FGh5acN1SBazHRVGk7DEcA Tue, 29 Mar 2016 09:52:56.576 +0000 (UTC) Date: Tue, 29 Mar 2016 09:52:56 +0000 From: naruse@airemix.jp To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 49302 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11901 X-Redmine-Issue-Author: amcaplan X-Redmine-Issue-Assignee: marcandre X-Redmine-Sender: naruse 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS59RpdHNhjc9qojHeDzKV+ruFapj90JUMAeU2 0j6HKLFeO33n/kGmM7HAZBn/w+n6Xviyr8UP5N/LrZTQMV6r4tKGwf+DYtZXQJTnJaaDGhYuzoAIDn sY1m89Z4WB22kuSg6f2co43iqGwUoGSzLR4y X-ML-Name: ruby-core X-Mail-Count: 74680 Subject: [ruby-core:74680] [Ruby trunk Bug#11901] Performance Issue with OpenStruct 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 #11901 has been updated by Yui NARUSE. Backport changed from 2.3: REQUIRED to 2.3: DONE ruby_2_3 r54388 merged revision(s) 53395,53396. ---------------------------------------- Bug #11901: Performance Issue with OpenStruct https://bugs.ruby-lang.org/issues/11901#change-57808 * Author: Ariel Caplan * Status: Closed * Priority: Normal * Assignee: Marc-Andre Lafortune * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13] * Backport: 2.3: DONE ---------------------------------------- After recent changes to define OpenStruct getter/setter methods lazily, there is a heavy performance impact for the use case where an attribute is assigned at initialization time (i.e. `Openstruct.new(foo: :bar)`). Once an attribute is stored in the internal hash, the appropriate singleton methods will never be defined, due to the recent changes to OpenStruct's `#respond_to_missing?` - meaning that every time I call `#foo` or `#foo=` it relies on `#method_missing`. Benchmark using benchmark-ips is attached. I'm primarily concerned about the case of configuration objects, which may be populated at initialization time and then accessed many times throughout the life of the program. ---Files-------------------------------- openstruct-regression-benchmark.rb (1.36 KB) -- https://bugs.ruby-lang.org/