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=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham 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 853091F4B4 for ; Fri, 2 Apr 2021 14:14:09 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 21607120A0A; Fri, 2 Apr 2021 23:13:05 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id DB52A120A09 for ; Fri, 2 Apr 2021 23:13:02 +0900 (JST) Received: by filterdrecv-p3mdw1-85cc49d4fc-m8v4h with SMTP id filterdrecv-p3mdw1-85cc49d4fc-m8v4h-19-606726A4-8E 2021-04-02 14:13:56.835736679 +0000 UTC m=+848453.205484046 Received: from herokuapp.com (unknown) by ismtpd0134p1iad2.sendgrid.net (SG) with ESMTP id mqBYQtJCQaOEJ7kiwkr6SA for ; Fri, 02 Apr 2021 14:13:56.716 +0000 (UTC) Date: Fri, 02 Apr 2021 14:13:56 +0000 (UTC) From: daniel@dan42.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 79227 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17472 X-Redmine-Issue-Author: naruse X-Redmine-Sender: Dan0042 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?8sy4RigFvRTdBfCVJrT9zb2J88PC92TMQwdNgaWYaq7l6Tlk7=2F1A1ENXRsK0A9?= =?us-ascii?Q?JtFbTvCMCdoq3fCumsDMhhSkQSDoJa=2FAoE+hRAT?= =?us-ascii?Q?4sIIgOcZRqE5CPB4atiJHV8LuOrcqj=2FLEVX8aHu?= =?us-ascii?Q?EmdOUDQobymmW58hAoZbtny+ymBTzFiCG8wjR0D?= =?us-ascii?Q?nJSmYytQknFTkam=2FGF+ddcLw=2F07EzZ+GH2=2FPayn?= =?us-ascii?Q?rs16u4V+z7iI8NIpg=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103184 Subject: [ruby-core:103184] [Ruby master Feature#17472] HashWithIndifferentAccess like Hash extension 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 #17472 has been updated by Dan0042 (Daniel DeLorme). lamont (Lamont Granquist) wrote in #note-24: > Although I really need to be able to inherit from the class and wrap convert_key/convert_value and it would be useful to have a private regular_writer/regular_update bypass (for performance) that subclasses could use for already-converted access. I don't think the current proposal would allow that. Although it's not super clear what the proposal is, specifically. It's "something" to make HashWithIndifferentAccess more performant via C implentation, but that "something" is quite vague. joelb (Joel Blum) wrote in #note-26: > I think we are not being needlessly stubborn, we really do run into symbol/string hash key bugs enough to make us want to use HashwithIndifferentAccess. Then by all means use it! What's the problem with HashWithIndifferentAccess if that's what you need? Several people have expressed their doubt that a C implementation would provide any significant speedup, and I agree. But as mame said, "we need to experiment" to see if that's the case or not. But before that we need a concrete proposal. Is it to add `Hash#compare_by_symbol=` ? ---------------------------------------- Feature #17472: HashWithIndifferentAccess like Hash extension https://bugs.ruby-lang.org/issues/17472#change-91259 * Author: naruse (Yui NARUSE) * Status: Open * Priority: Normal * Target version: 3.1 ---------------------------------------- Rails has [ActiveSupport::HashWithIndifferentAccess](https://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html), which is widely used in Rails to handle Request, Session, ActionView's form construction, ActiveRecord's DB communication, and so on. It receives String or Symbol and normalize them to fetch the value. But it is implemented with Ruby. If we provide C implementation of that, Rails will gain the performance improvement. summary of previous discussion: https://github.com/rails/rails/pull/40182#issuecomment-687607812 -- https://bugs.ruby-lang.org/