rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Aaron Patterson <tenderlove@ruby-lang.org>
To: rack-devel@googlegroups.com
Cc: Aaron Patterson <tenderlove@ruby-lang.org>,
	richard schneeman <richard.schneeman@gmail.com>
Subject: Re: Less allocated objects on each request
Date: Fri, 17 Jun 2016 16:19:11 -0700	[thread overview]
Message-ID: <20160617231911.GA87608@TC.local> (raw)
In-Reply-To: <20160617231239.GA16185@dcvr.yhbt.net>

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

On Fri, Jun 17, 2016 at 11:12:39PM +0000, Eric Wong wrote:
> The following also breaks the opt_case_dispatch optimization so
> it becomes a linear scan, but it still avoids allocating:
> 
> 	case value.class.to_s
> 	when "String".freeze, "Symbol".freeze
> 	when "Array".freeze
> 	  something
> 	else
> 	  something_else
> 	end

Huh.  I didn't know adding the `freeze` would kill the optimization.
Seems like we could fix that, though I'm not sure why anyone would do
this.  You can't access the strings anyway so freezing seems pointless
(maybe even warning worthy?)

-- 
Aaron Patterson
http://tenderlovemaking.com/

-- 

--- 
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2016-06-17 23:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 20:08 Less allocated objects on each request Eric Wong
2014-10-05  8:15 ` [PATCH] conditionalget: avoid const lookup in case/when Eric Wong
2014-10-05 21:37   ` James Tucker
2014-10-06 20:00     ` richard schneeman
2016-05-12  3:04       ` Less allocated objects on each request Eric Wong
2016-05-12 16:54         ` Aaron Patterson
2016-05-12 17:01           ` richard schneeman
2016-05-13 23:41           ` Eric Wong
2016-06-17 19:43             ` richard schneeman
2016-06-17 21:00               ` Aaron Patterson
2016-06-17 23:12                 ` Eric Wong
2016-06-17 23:19                   ` Aaron Patterson [this message]
2016-06-17 23:43                     ` Eric Wong
2014-10-05 21:31 ` James Tucker

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://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160617231911.GA87608@TC.local \
    --to=rack-devel@googlegroups.com \
    --cc=richard.schneeman@gmail.com \
    --cc=tenderlove@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).