String concat contains dummy comparision.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- ruby
- Domain
- performance
Research direction
Search the repository for the String concatenation benchmark described in the issue and read its current setup and reported cases. Update the benchmark to cover randomized string lengths and multiple-string concatenation, then compare the results against the examples in the issue to confirm the misleading fixed-input comparison is addressed.
Written by the indexing model from the issue text.
Description
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'}".
- Dominant language
- Ruby
- Stars
- 5.7k
- Forks
- 370
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fastruby/fast-ruby
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
All issues in fastruby/fast-ruby
Similar issues
-
SyncEm always forwards a dummy block, so wrapped methods lose their no-block/Enumerator behavior Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
dependabot
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
githubnext/gh-aw-cao#13349 ·
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·