Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

String concat contains dummy comparision.

未关闭
#158 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
performance

调研方向

在 repository 中搜索 issue 所描述的 String concatenation 基准测试,并阅读其当前设置和已报告的案例。更新该基准测试,使其覆盖随机化的字符串长度和多字符串拼接,然后将结果与 issue 中的示例进行比较,以确认具有误导性的固定输入比较已得到解决。

由索引模型根据 Issue 内容生成。

描述

You are doing your test without any randomization and length variety, so results are incorrect completely.

You simply just testing how fast are 'foo' and 'bar' concatenation, and only

Live case scenario looks more like this:

# strings length is a ( 100 + rand( 100 ) ), i.e. short strings max difference around double 

 String#append:   439150.7 i/s
            String#+:   419672.1 i/s - same-ish: difference falls within error
  "#{'foo'}#{'bar'}":   365799.6 i/s - 1.20x  slower
       String#concat:   353912.5 i/s - 1.24x  slower

 # strings length is a  (1000 + rand( 1000) ) , i.e. longer strings max difference around double

            String#+:   298633.5 i/s
   String#append:   284566.8 i/s - same-ish: difference falls within error
  "#{'foo'}#{'bar'}":   267548.4 i/s - 1.12x  slower
    String#concat:   215419.4 i/s - 1.39x  slower

# string length is a ( 100 + rand(1000) ), i.e. highly variable length
             String#+:   388205.2 i/s
   String#append:   357669.3 i/s - 1.09x  slower
  "#{'foo'}#{'bar'}":   331617.7 i/s - 1.17x  slower
    String#concat:   286717.8 i/s - 1.35x  slower

# string length is a 1 + rand 1000, i.e. random string
             String#+:   385180.8 i/s
   String#append:   373926.8 i/s - same-ish: difference falls within error
  "#{'foo'}#{'bar'}":   341496.6 i/s - 1.13x  slower
   String#concat:   297988.1 i/s - 1.29x  slower

OK

# This is completely oposite to
         "foo" "bar":  5369594.5 i/s
 "#{'foo'}#{'bar'}":  5181745.7 i/s - same-ish: difference falls within error
   String#append:  3075719.2 i/s - 1.75x slower
    String#concat:  3016703.5 i/s - 1.78x slower
            String#+:  2977282.7 i/s - 1.80x slower

Also you didn't test on multiple string concat, where actually "#{'foo'} #{'bar'} #{'shines'}".

主要语言
Ruby
星标
5.7k
派生
370
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fastruby/fast-ruby 的其他 Issue

查看 fastruby/fast-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。