{"action":"created","comment":{"url":"https://api.github.com/repos/MoarVM/MoarVM/pulls/comments/141350720","pull_request_review_id":65550810,"id":141350720,"diff_hunk":"@@ -1630,16 +1631,35 @@ MVMString * MVM_string_join(MVMThreadContext *tc, MVMString *separator, MVMObjec\n     is_str_array = REPR(input)->pos_funcs.get_elem_storage_spec(tc,\n         STABLE(input)).boxed_primitive == MVM_STORAGE_SPEC_BP_STR;\n \n+    /* If there's only one element to join, just return it. */\n+    if (elems == 1) {\n+        if (is_str_array) {\n+            MVMString *piece = MVM_repr_at_pos_s(tc, input, 0);\n+            if (piece)\n+                return piece;\n+        }\n+        else {\n+            MVMObject *item = MVM_repr_at_pos_o(tc, input, 0);\n+            if (item && IS_CONCRETE(item))\n+                return MVM_repr_get_str(tc, item);\n+        }\n+    }\n+\n     /* Allocate result. */\n     MVMROOT(tc, separator, {\n     MVMROOT(tc, input, {\n         result = (MVMString *)MVM_repr_alloc_init(tc, tc->instance->VMString);\n     });\n     });\n \n+    /* If the separator is a strand, find out its storage_type. */\n+    all_strands_of_same_type = separator->body.storage_type == MVM_STRING_STRAND;\n+    if (all_strands_of_same_type)\n+        strand_type = separator->body.storage.strands->blob_string->body.storage_type;","path":"src/strings/ops.c","position":36,"original_position":36,"commit_id":"40da3e6e0b315806269226dd1bb23f83f69e10a9","original_commit_id":"40da3e6e0b315806269226dd1bb23f83f69e10a9","user":{"login":"MasterDuke17","id":10255441,"avatar_url":"https://avatars0.githubusercontent.com/u/10255441?v=4","gravatar_id":"","url":"https://api.github.com/users/MasterDuke17","html_url":"https://github.com/MasterDuke17","followers_url":"https://api.github.com/users/MasterDuke17/followers","following_url":"https://api.github.com/users/MasterDuke17/following{/other_user}","gists_url":"https://api.github.com/users/MasterDuke17/gists{/gist_id}","starred_url":"https://api.github.com/users/MasterDuke17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MasterDuke17/subscriptions","organizations_url":"https://api.github.com/users/MasterDuke17/orgs","repos_url":"https://api.github.com/users/MasterDuke17/repos","events_url":"https://api.github.com/users/MasterDuke17/events{/privacy}","received_events_url":"https://api.github.com/users/MasterDuke17/received_events","type":"User","site_admin":false},"body":"Huh, I think I misinterpreted something @timo said (https://irclog.perlgeek.de/perl6-dev/2017-09-23#i_15206788) about doing that as an optimization. I thought he meant make support for mixed strings, but now I see he meant actually make strings with mixed strands, since that is actually supported. Cool, I'll add a commit removing that restriction.","created_at":"2017-09-27T13:58:02Z","updated_at":"2017-09-27T13:58:02Z","html_url":"https://github.com/MoarVM/MoarVM/pull/705#discussion_r141350720","pull_request_url":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/MoarVM/MoarVM/pulls/comments/141350720"},"html":{"href":"https://github.com/MoarVM/MoarVM/pull/705#discussion_r141350720"},"pull_request":{"href":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705"}},"in_reply_to_id":141331726},"pull_request":{"url":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705","id":142739847,"html_url":"https://github.com/MoarVM/MoarVM/pull/705","diff_url":"https://github.com/MoarVM/MoarVM/pull/705.diff","patch_url":"https://github.com/MoarVM/MoarVM/pull/705.patch","issue_url":"https://api.github.com/repos/MoarVM/MoarVM/issues/705","number":705,"state":"open","locked":false,"title":"Optimize MVM_string_join in both case of all strands and case of a single element to join","user":{"login":"MasterDuke17","id":10255441,"avatar_url":"https://avatars0.githubusercontent.com/u/10255441?v=4","gravatar_id":"","url":"https://api.github.com/users/MasterDuke17","html_url":"https://github.com/MasterDuke17","followers_url":"https://api.github.com/users/MasterDuke17/followers","following_url":"https://api.github.com/users/MasterDuke17/following{/other_user}","gists_url":"https://api.github.com/users/MasterDuke17/gists{/gist_id}","starred_url":"https://api.github.com/users/MasterDuke17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MasterDuke17/subscriptions","organizations_url":"https://api.github.com/users/MasterDuke17/orgs","repos_url":"https://api.github.com/users/MasterDuke17/repos","events_url":"https://api.github.com/users/MasterDuke17/events{/privacy}","received_events_url":"https://api.github.com/users/MasterDuke17/received_events","type":"User","site_admin":false},"body":"When everything to be joined are strands of the same type, just copy\r\nthem directly instead of creating a single flat string. For small\r\nstrings the overhead of being strands counteracts the saving in copying,\r\nbut for large strings it's much faster.\r\n\r\nFor example:\r\n```\r\nmy $b = \"bbbbbbbb\" x 200;\r\nmy $c = \"cccccccccccccc\" x 300;\r\nfor ^100_000 {\r\n    $ = join(\",\", $b, $c, \"dddd\")\r\n}\r\n```\r\ntook ~3.7s before this change and ~1.5s after.\r\n\r\nNQP builds ok and passes `make m-test` and Rakudo builds ok and passes `make m-test m-spectest`.","created_at":"2017-09-24T04:29:30Z","updated_at":"2017-09-27T13:58:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cef8bb448925ce5f69dd1097ec7931caeac323af","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705/commits","review_comments_url":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705/comments","review_comment_url":"https://api.github.com/repos/MoarVM/MoarVM/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MoarVM/MoarVM/issues/705/comments","statuses_url":"https://api.github.com/repos/MoarVM/MoarVM/statuses/40da3e6e0b315806269226dd1bb23f83f69e10a9","head":{"label":"MasterDuke17:just_copy_strands_in_join_if_able","ref":"just_copy_strands_in_join_if_able","sha":"40da3e6e0b315806269226dd1bb23f83f69e10a9","user":{"login":"MasterDuke17","id":10255441,"avatar_url":"https://avatars0.githubusercontent.com/u/10255441?v=4","gravatar_id":"","url":"https://api.github.com/users/MasterDuke17","html_url":"https://github.com/MasterDuke17","followers_url":"https://api.github.com/users/MasterDuke17/followers","following_url":"https://api.github.com/users/MasterDuke17/following{/other_user}","gists_url":"https://api.github.com/users/MasterDuke17/gists{/gist_id}","starred_url":"https://api.github.com/users/MasterDuke17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MasterDuke17/subscriptions","organizations_url":"https://api.github.com/users/MasterDuke17/orgs","repos_url":"https://api.github.com/users/MasterDuke17/repos","events_url":"https://api.github.com/users/MasterDuke17/events{/privacy}","received_events_url":"https://api.github.com/users/MasterDuke17/received_events","type":"User","site_admin":false},"repo":{"id":60421871,"name":"MoarVM","full_name":"MasterDuke17/MoarVM","owner":{"login":"MasterDuke17","id":10255441,"avatar_url":"https://avatars0.githubusercontent.com/u/10255441?v=4","gravatar_id":"","url":"https://api.github.com/users/MasterDuke17","html_url":"https://github.com/MasterDuke17","followers_url":"https://api.github.com/users/MasterDuke17/followers","following_url":"https://api.github.com/users/MasterDuke17/following{/other_user}","gists_url":"https://api.github.com/users/MasterDuke17/gists{/gist_id}","starred_url":"https://api.github.com/users/MasterDuke17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MasterDuke17/subscriptions","organizations_url":"https://api.github.com/users/MasterDuke17/orgs","repos_url":"https://api.github.com/users/MasterDuke17/repos","events_url":"https://api.github.com/users/MasterDuke17/events{/privacy}","received_events_url":"https://api.github.com/users/MasterDuke17/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MasterDuke17/MoarVM","description":"A 6model-based VM for NQP and Rakudo Perl 6.","fork":true,"url":"https://api.github.com/repos/MasterDuke17/MoarVM","forks_url":"https://api.github.com/repos/MasterDuke17/MoarVM/forks","keys_url":"https://api.github.com/repos/MasterDuke17/MoarVM/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MasterDuke17/MoarVM/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MasterDuke17/MoarVM/teams","hooks_url":"https://api.github.com/repos/MasterDuke17/MoarVM/hooks","issue_events_url":"https://api.github.com/repos/MasterDuke17/MoarVM/issues/events{/number}","events_url":"https://api.github.com/repos/MasterDuke17/MoarVM/events","assignees_url":"https://api.github.com/repos/MasterDuke17/MoarVM/assignees{/user}","branches_url":"https://api.github.com/repos/MasterDuke17/MoarVM/branches{/branch}","tags_url":"https://api.github.com/repos/MasterDuke17/MoarVM/tags","blobs_url":"https://api.github.com/repos/MasterDuke17/MoarVM/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MasterDuke17/MoarVM/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MasterDuke17/MoarVM/git/refs{/sha}","trees_url":"https://api.github.com/repos/MasterDuke17/MoarVM/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MasterDuke17/MoarVM/statuses/{sha}","languages_url":"https://api.github.com/repos/MasterDuke17/MoarVM/languages","stargazers_url":"https://api.github.com/repos/MasterDuke17/MoarVM/stargazers","contributors_url":"https://api.github.com/repos/MasterDuke17/MoarVM/contributors","subscribers_url":"https://api.github.com/repos/MasterDuke17/MoarVM/subscribers","subscription_url":"https://api.github.com/repos/MasterDuke17/MoarVM/subscription","commits_url":"https://api.github.com/repos/MasterDuke17/MoarVM/commits{/sha}","git_commits_url":"https://api.github.com/repos/MasterDuke17/MoarVM/git/commits{/sha}","comments_url":"https://api.github.com/repos/MasterDuke17/MoarVM/comments{/number}","issue_comment_url":"https://api.github.com/repos/MasterDuke17/MoarVM/issues/comments{/number}","contents_url":"https://api.github.com/repos/MasterDuke17/MoarVM/contents/{+path}","compare_url":"https://api.github.com/repos/MasterDuke17/MoarVM/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MasterDuke17/MoarVM/merges","archive_url":"https://api.github.com/repos/MasterDuke17/MoarVM/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MasterDuke17/MoarVM/downloads","issues_url":"https://api.github.com/repos/MasterDuke17/MoarVM/issues{/number}","pulls_url":"https://api.github.com/repos/MasterDuke17/MoarVM/pulls{/number}","milestones_url":"https://api.github.com/repos/MasterDuke17/MoarVM/milestones{/number}","notifications_url":"https://api.github.com/repos/MasterDuke17/MoarVM/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MasterDuke17/MoarVM/labels{/name}","releases_url":"https://api.github.com/repos/MasterDuke17/MoarVM/releases{/id}","deployments_url":"https://api.github.com/repos/MasterDuke17/MoarVM/deployments","created_at":"2016-06-04T17:23:06Z","updated_at":"2016-06-04T17:23:08Z","pushed_at":"2017-09-27T00:35:39Z","git_url":"git://github.com/MasterDuke17/MoarVM.git","ssh_url":"git@github.com:MasterDuke17/MoarVM.git","clone_url":"https://github.com/MasterDuke17/MoarVM.git","svn_url":"https://github.com/MasterDuke17/MoarVM","homepage":"","size":36316,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MoarVM:master","ref":"master","sha":"b46ef347054cca5da9d0551e4fb8bba7fb47cdc6","user":{"login":"MoarVM","id":4582420,"avatar_url":"https://avatars0.githubusercontent.com/u/4582420?v=4","gravatar_id":"","url":"https://api.github.com/users/MoarVM","html_url":"https://github.com/MoarVM","followers_url":"https://api.github.com/users/MoarVM/followers","following_url":"https://api.github.com/users/MoarVM/following{/other_user}","gists_url":"https://api.github.com/users/MoarVM/gists{/gist_id}","starred_url":"https://api.github.com/users/MoarVM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoarVM/subscriptions","organizations_url":"https://api.github.com/users/MoarVM/orgs","repos_url":"https://api.github.com/users/MoarVM/repos","events_url":"https://api.github.com/users/MoarVM/events{/privacy}","received_events_url":"https://api.github.com/users/MoarVM/received_events","type":"Organization","site_admin":false},"repo":{"id":10411154,"name":"MoarVM","full_name":"MoarVM/MoarVM","owner":{"login":"MoarVM","id":4582420,"avatar_url":"https://avatars0.githubusercontent.com/u/4582420?v=4","gravatar_id":"","url":"https://api.github.com/users/MoarVM","html_url":"https://github.com/MoarVM","followers_url":"https://api.github.com/users/MoarVM/followers","following_url":"https://api.github.com/users/MoarVM/following{/other_user}","gists_url":"https://api.github.com/users/MoarVM/gists{/gist_id}","starred_url":"https://api.github.com/users/MoarVM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoarVM/subscriptions","organizations_url":"https://api.github.com/users/MoarVM/orgs","repos_url":"https://api.github.com/users/MoarVM/repos","events_url":"https://api.github.com/users/MoarVM/events{/privacy}","received_events_url":"https://api.github.com/users/MoarVM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MoarVM/MoarVM","description":"A modern VM built for Rakudo Perl 6.","fork":false,"url":"https://api.github.com/repos/MoarVM/MoarVM","forks_url":"https://api.github.com/repos/MoarVM/MoarVM/forks","keys_url":"https://api.github.com/repos/MoarVM/MoarVM/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MoarVM/MoarVM/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MoarVM/MoarVM/teams","hooks_url":"https://api.github.com/repos/MoarVM/MoarVM/hooks","issue_events_url":"https://api.github.com/repos/MoarVM/MoarVM/issues/events{/number}","events_url":"https://api.github.com/repos/MoarVM/MoarVM/events","assignees_url":"https://api.github.com/repos/MoarVM/MoarVM/assignees{/user}","branches_url":"https://api.github.com/repos/MoarVM/MoarVM/branches{/branch}","tags_url":"https://api.github.com/repos/MoarVM/MoarVM/tags","blobs_url":"https://api.github.com/repos/MoarVM/MoarVM/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MoarVM/MoarVM/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MoarVM/MoarVM/git/refs{/sha}","trees_url":"https://api.github.com/repos/MoarVM/MoarVM/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MoarVM/MoarVM/statuses/{sha}","languages_url":"https://api.github.com/repos/MoarVM/MoarVM/languages","stargazers_url":"https://api.github.com/repos/MoarVM/MoarVM/stargazers","contributors_url":"https://api.github.com/repos/MoarVM/MoarVM/contributors","subscribers_url":"https://api.github.com/repos/MoarVM/MoarVM/subscribers","subscription_url":"https://api.github.com/repos/MoarVM/MoarVM/subscription","commits_url":"https://api.github.com/repos/MoarVM/MoarVM/commits{/sha}","git_commits_url":"https://api.github.com/repos/MoarVM/MoarVM/git/commits{/sha}","comments_url":"https://api.github.com/repos/MoarVM/MoarVM/comments{/number}","issue_comment_url":"https://api.github.com/repos/MoarVM/MoarVM/issues/comments{/number}","contents_url":"https://api.github.com/repos/MoarVM/MoarVM/contents/{+path}","compare_url":"https://api.github.com/repos/MoarVM/MoarVM/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MoarVM/MoarVM/merges","archive_url":"https://api.github.com/repos/MoarVM/MoarVM/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MoarVM/MoarVM/downloads","issues_url":"https://api.github.com/repos/MoarVM/MoarVM/issues{/number}","pulls_url":"https://api.github.com/repos/MoarVM/MoarVM/pulls{/number}","milestones_url":"https://api.github.com/repos/MoarVM/MoarVM/milestones{/number}","notifications_url":"https://api.github.com/repos/MoarVM/MoarVM/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MoarVM/MoarVM/labels{/name}","releases_url":"https://api.github.com/repos/MoarVM/MoarVM/releases{/id}","deployments_url":"https://api.github.com/repos/MoarVM/MoarVM/deployments","created_at":"2013-05-31T19:02:30Z","updated_at":"2017-09-26T10:31:06Z","pushed_at":"2017-09-27T13:00:19Z","git_url":"git://github.com/MoarVM/MoarVM.git","ssh_url":"git@github.com:MoarVM/MoarVM.git","clone_url":"https://github.com/MoarVM/MoarVM.git","svn_url":"https://github.com/MoarVM/MoarVM","homepage":"https://www.moarvm.org/","size":41084,"stargazers_count":348,"watchers_count":348,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":101,"mirror_url":null,"open_issues_count":98,"forks":101,"open_issues":98,"watchers":348,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705"},"html":{"href":"https://github.com/MoarVM/MoarVM/pull/705"},"issue":{"href":"https://api.github.com/repos/MoarVM/MoarVM/issues/705"},"comments":{"href":"https://api.github.com/repos/MoarVM/MoarVM/issues/705/comments"},"review_comments":{"href":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705/comments"},"review_comment":{"href":"https://api.github.com/repos/MoarVM/MoarVM/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MoarVM/MoarVM/pulls/705/commits"},"statuses":{"href":"https://api.github.com/repos/MoarVM/MoarVM/statuses/40da3e6e0b315806269226dd1bb23f83f69e10a9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"MasterDuke17"}}