<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Pocke</author_name>
  <author_url>https://blog.hatena.ne.jp/Pocke/</author_url>
  <blog_title>pockestrap</blog_title>
  <blog_url>https://pocke.hatenablog.com/</blog_url>
  <categories>
    <anon>Programming</anon>
    <anon>Ruby</anon>
  </categories>
  <description>ruby-jp1のSlackで話していて面白かったのでまとめ。 Slack上の発言 RubyのString#gsub!はString#gsubの破壊的バージョンで、置換結果でレシーバを上書きする。 当然gsub!の方が新しいStringオブジェクトを生成しないので速いと思っていたら、どうやらそんなことはない(しかもgsub!のほうが微妙に遅い)ようなので盛り上がった。 ベンチマーク ベンチマークは次の通り。mameさんが出してくれたサンプルコードをそのままコピペしている。 ss = &quot;abcde&quot; * 100 t = Time.now 100000.times do s = ss s = s.…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpocke.hatenablog.com%2Fentry%2F2019%2F09%2F13%2F221013&quot; title=&quot;String#gsub! は String#gsub よりも遅い - pockestrap&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/P/Pocke/20190913/20190913215326.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-09-13 22:10:13</published>
  <title>String#gsub! は String#gsub よりも遅い</title>
  <type>rich</type>
  <url>https://pocke.hatenablog.com/entry/2019/09/13/221013</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
