From: naruse@airemix.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:72639] [Ruby trunk - Bug #11901] [Closed] Performance Issue with OpenStruct
Date: Thu, 31 Dec 2015 17:10:16 +0000 [thread overview]
Message-ID: <redmine.journal-55890.20151231171015.666c7116d45cdffe@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11901.20151227153720@ruby-lang.org
Issue #11901 has been updated by Yui NARUSE.
Status changed from Open to Closed
Could you fix rubyspec?
----------------------------------------
Bug #11901: Performance Issue with OpenStruct
https://bugs.ruby-lang.org/issues/11901#change-55890
* 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: REQUIRED
----------------------------------------
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/
next prev parent reply other threads:[~2015-12-31 16:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-11901.20151227153720@ruby-lang.org>
2015-12-27 15:37 ` [ruby-core:72523] [Ruby trunk - Bug #11901] [Open] Performance Issue with OpenStruct ariel.caplan
2015-12-27 15:48 ` [ruby-core:72524] [Ruby trunk - Bug #11901] " ariel.caplan
2015-12-27 16:02 ` [ruby-core:72525] " ariel.caplan
2015-12-31 5:40 ` [ruby-core:72631] " ruby-core
2015-12-31 5:43 ` [ruby-core:72632] " ruby-core
2015-12-31 17:10 ` naruse [this message]
2016-01-01 17:35 ` [ruby-core:72658] " ruby-core
2016-01-01 17:38 ` [ruby-core:72659] " eregontp
2016-03-29 9:52 ` [ruby-core:74680] [Ruby trunk Bug#11901] " naruse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-55890.20151231171015.666c7116d45cdffe@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).