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 D2CAB1960042 for ; Wed, 24 Jun 2015 17:44:49 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 7E0A7B5D939 for ; Wed, 24 Jun 2015 18:08:50 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 9748E97A832 for ; Wed, 24 Jun 2015 18:08:52 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MJscbkr5QxE3 for ; Wed, 24 Jun 2015 18:08:51 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id CB6EC97A839 for ; Wed, 24 Jun 2015 18:08:51 +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 82099952447 for ; Wed, 24 Jun 2015 18:08:48 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 03E4E12044C; Wed, 24 Jun 2015 18:08:47 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 21296120410 for ; Wed, 24 Jun 2015 18:08:39 +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=m8LU2v/7BMirtFr7gsWSILSolss=; b=FuMaX+vr0TU6hiAC0w HjTZJoEmuI+w3mDPvk45YCOPh6SVlzutIs7+2/F0aSrN6BA700ceRlr+O1svln+3 kl82W/3WWlymi3dbFpvS1qk9B2qaGRDnpsCP5MRUo3Fm8HTgEQCfdr1fc0av4kW1 RuaPM2uABCNB9GwvGG6r/eYko= Received: by filter0624p1mdw1.sendgrid.net with SMTP id filter0624p1mdw1.22467.558A73911F 2015-06-24 09:08:33.632823903 +0000 UTC Received: from herokuapp.com (ec2-54-91-205-17.compute-1.amazonaws.com [54.91.205.17]) by ismtpd-022 (SG) with ESMTP id 14e24d37139.5263.49fb0c for ; Wed, 24 Jun 2015 09:08:33 +0000 (UTC) Date: Wed, 24 Jun 2015 09:08:33 +0000 From: funny.falcon@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 44301 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 10585 X-Redmine-Issue-Author: funny_falcon X-Redmine-Sender: funny_falcon 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6I+RhRZF5J/F1MqSdAiVj6c6XcWbYHbUbzUQ 2F9qMtsDlmgVpp+8lWLYlC26i6aaVBXnotse/eVFcbHCkAvjAhIU+8BQAdCCYFNTSjSfhtrozlPIih WRkgvg1nCSoJMbo1A1u72neau99btHe0RbyP X-ML-Name: ruby-core X-Mail-Count: 69729 Subject: [ruby-core:69729] [Ruby trunk - Feature #10585] struct: speedup struct.attr = v for first 10 attributes and struct[:attr] for big structs 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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #10585 has been updated by Yura Sokolov. imho, 0001 is very important, cause it gives most of performance improvement for usual case. For now, I think twice: use struct or object, despite that struct is looking better and provides smaller and cleaner code. If setter's will be faster, than struct will be much more usable. ---------------------------------------- Feature #10585: struct: speedup struct.attr = v for first 10 attributes and struct[:attr] for big structs https://bugs.ruby-lang.org/issues/10585#change-53110 * Author: Yura Sokolov * Status: Open * Priority: Normal * Assignee: ---------------------------------------- 0001 - Define optimized setters for first 10 attributes. 0002 - Cache members definition in an subclasses - it is safe cause it could be modified/overloaded. And use `rb_attr_get` to lookup definition - it is safe cause result is checked later and `Qnil` is treated as error. 0003,0004 - Use custom hash structure (on top of Array) to lookup members index in a big structure. Well, I doubt that big structures are useful, so I will not grieve if 0004 is not accepted. ---Files-------------------------------- 0001-struct.c-speedup-struct.name-v-for-small-structs.patch (2.33 KB) 0002-struct.c-cache-member-definition-in-a-subclass.patch (1.09 KB) 0003-benchmark-struct-name.patch (2.42 KB) 0004-struct.c-speedup-for-big-structs.patch (5.47 KB) 0002-struct.c-cache-member-definition-in-a-subclass.patch (1.09 KB) -- https://bugs.ruby-lang.org/