{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/65109462","id":65109462,"diff_hunk":"@@ -135,17 +135,44 @@ end\n \n ## Generic indexing functions ##\n \n-prevind(s::DirectIndexString, i::Integer) = i-1\n-prevind(s::AbstractArray   , i::Integer) = i-1\n-nextind(s::DirectIndexString, i::Integer) = i+1\n-nextind(s::AbstractArray   , i::Integer) = i+1\n+prevind(s::DirectIndexString, i::Integer) = convert(Int, i)-1\n+prevind(s::AbstractArray   , i::Integer) = convert(Int, i)-1","path":"base/strings/basic.jl","position":null,"original_position":9,"commit_id":"3e63a0e4b5ec9c9a91dd2ab38c3bc64f34dd8493","original_commit_id":"5ac35fe2d68ece69910362b02cfe5407faa783ad","user":{"login":"tkelman","id":5934628,"avatar_url":"https://avatars.githubusercontent.com/u/5934628?v=3","gravatar_id":"","url":"https://api.github.com/users/tkelman","html_url":"https://github.com/tkelman","followers_url":"https://api.github.com/users/tkelman/followers","following_url":"https://api.github.com/users/tkelman/following{/other_user}","gists_url":"https://api.github.com/users/tkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/tkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkelman/subscriptions","organizations_url":"https://api.github.com/users/tkelman/orgs","repos_url":"https://api.github.com/users/tkelman/repos","events_url":"https://api.github.com/users/tkelman/events{/privacy}","received_events_url":"https://api.github.com/users/tkelman/received_events","type":"User","site_admin":false},"body":"`Int(i-1)` would have better behavior near overflow corner cases IMO","created_at":"2016-05-30T22:51:08Z","updated_at":"2016-05-30T22:51:08Z","html_url":"https://github.com/JuliaLang/julia/pull/16648#discussion_r65109462","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/16648","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/65109462"},"html":{"href":"https://github.com/JuliaLang/julia/pull/16648#discussion_r65109462"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/16648"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/16648","id":71832616,"html_url":"https://github.com/JuliaLang/julia/pull/16648","diff_url":"https://github.com/JuliaLang/julia/pull/16648.diff","patch_url":"https://github.com/JuliaLang/julia/pull/16648.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/16648","number":16648,"state":"open","locked":false,"title":"Specialize nextind and prevind for String","user":{"login":"TotalVerb","id":12903942,"avatar_url":"https://avatars.githubusercontent.com/u/12903942?v=3","gravatar_id":"","url":"https://api.github.com/users/TotalVerb","html_url":"https://github.com/TotalVerb","followers_url":"https://api.github.com/users/TotalVerb/followers","following_url":"https://api.github.com/users/TotalVerb/following{/other_user}","gists_url":"https://api.github.com/users/TotalVerb/gists{/gist_id}","starred_url":"https://api.github.com/users/TotalVerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TotalVerb/subscriptions","organizations_url":"https://api.github.com/users/TotalVerb/orgs","repos_url":"https://api.github.com/users/TotalVerb/repos","events_url":"https://api.github.com/users/TotalVerb/events{/privacy}","received_events_url":"https://api.github.com/users/TotalVerb/received_events","type":"User","site_admin":false},"body":"Now that there is only one `String` type in `Base`, it might be worth optimizing it. The specializations here get around two-fold performance boost compared to the generic variants:\r\n\r\nIn the benchmarks below, `Base.{next|prev}ind` refers to the old version, and `{next|prev}ind` to the new version.\r\n\r\n```julia\r\njulia> @benchmark sum(prevind(\"Hello World\", i) for i in -1:11)\r\nTrial(130.00 ns)\r\n\r\njulia> @benchmark sum(Base.prevind(\"Hello World\", i) for i in -1:11)\r\nTrial(238.00 ns)\r\n\r\njulia> @benchmark sum(nextind(\"Hello World\", i) for i in -1:11)\r\nTrial(122.00 ns)\r\n\r\njulia> @benchmark sum(Base.nextind(\"Hello World\", i) for i in -1:11)\r\nTrial(286.00 ns)\r\n\r\njulia> @benchmark sum(prevind(\"αβγδϵζ😄🍕\", i) for i in 0:21)\r\nTrial(224.00 ns)\r\n\r\njulia> @benchmark sum(Base.prevind(\"αβγδϵζ😄🍕\", i) for i in 0:21)\r\nTrial(490.00 ns)\r\n\r\njulia> @benchmark sum(nextind(\"αβγδϵζ😄🍕\", i) for i in 0:21)\r\nTrial(199.00 ns)\r\n\r\njulia> @benchmark sum(Base.nextind(\"αβγδϵζ😄🍕\", i) for i in 0:21)\r\nTrial(556.00 ns)\r\n```","created_at":"2016-05-29T17:25:16Z","updated_at":"2016-05-30T22:51:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7b7d05744d6ef3baac7a2800a6922ce9b8e2de0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/16648/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/16648/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/16648/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/3e63a0e4b5ec9c9a91dd2ab38c3bc64f34dd8493","head":{"label":"TotalVerb:fast-utf8string","ref":"fast-utf8string","sha":"3e63a0e4b5ec9c9a91dd2ab38c3bc64f34dd8493","user":{"login":"TotalVerb","id":12903942,"avatar_url":"https://avatars.githubusercontent.com/u/12903942?v=3","gravatar_id":"","url":"https://api.github.com/users/TotalVerb","html_url":"https://github.com/TotalVerb","followers_url":"https://api.github.com/users/TotalVerb/followers","following_url":"https://api.github.com/users/TotalVerb/following{/other_user}","gists_url":"https://api.github.com/users/TotalVerb/gists{/gist_id}","starred_url":"https://api.github.com/users/TotalVerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TotalVerb/subscriptions","organizations_url":"https://api.github.com/users/TotalVerb/orgs","repos_url":"https://api.github.com/users/TotalVerb/repos","events_url":"https://api.github.com/users/TotalVerb/events{/privacy}","received_events_url":"https://api.github.com/users/TotalVerb/received_events","type":"User","site_admin":false},"repo":{"id":56201182,"name":"julia","full_name":"TotalVerb/julia","owner":{"login":"TotalVerb","id":12903942,"avatar_url":"https://avatars.githubusercontent.com/u/12903942?v=3","gravatar_id":"","url":"https://api.github.com/users/TotalVerb","html_url":"https://github.com/TotalVerb","followers_url":"https://api.github.com/users/TotalVerb/followers","following_url":"https://api.github.com/users/TotalVerb/following{/other_user}","gists_url":"https://api.github.com/users/TotalVerb/gists{/gist_id}","starred_url":"https://api.github.com/users/TotalVerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TotalVerb/subscriptions","organizations_url":"https://api.github.com/users/TotalVerb/orgs","repos_url":"https://api.github.com/users/TotalVerb/repos","events_url":"https://api.github.com/users/TotalVerb/events{/privacy}","received_events_url":"https://api.github.com/users/TotalVerb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TotalVerb/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":true,"url":"https://api.github.com/repos/TotalVerb/julia","forks_url":"https://api.github.com/repos/TotalVerb/julia/forks","keys_url":"https://api.github.com/repos/TotalVerb/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TotalVerb/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TotalVerb/julia/teams","hooks_url":"https://api.github.com/repos/TotalVerb/julia/hooks","issue_events_url":"https://api.github.com/repos/TotalVerb/julia/issues/events{/number}","events_url":"https://api.github.com/repos/TotalVerb/julia/events","assignees_url":"https://api.github.com/repos/TotalVerb/julia/assignees{/user}","branches_url":"https://api.github.com/repos/TotalVerb/julia/branches{/branch}","tags_url":"https://api.github.com/repos/TotalVerb/julia/tags","blobs_url":"https://api.github.com/repos/TotalVerb/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TotalVerb/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TotalVerb/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/TotalVerb/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TotalVerb/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/TotalVerb/julia/languages","stargazers_url":"https://api.github.com/repos/TotalVerb/julia/stargazers","contributors_url":"https://api.github.com/repos/TotalVerb/julia/contributors","subscribers_url":"https://api.github.com/repos/TotalVerb/julia/subscribers","subscription_url":"https://api.github.com/repos/TotalVerb/julia/subscription","commits_url":"https://api.github.com/repos/TotalVerb/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/TotalVerb/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/TotalVerb/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/TotalVerb/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/TotalVerb/julia/contents/{+path}","compare_url":"https://api.github.com/repos/TotalVerb/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TotalVerb/julia/merges","archive_url":"https://api.github.com/repos/TotalVerb/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TotalVerb/julia/downloads","issues_url":"https://api.github.com/repos/TotalVerb/julia/issues{/number}","pulls_url":"https://api.github.com/repos/TotalVerb/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/TotalVerb/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/TotalVerb/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TotalVerb/julia/labels{/name}","releases_url":"https://api.github.com/repos/TotalVerb/julia/releases{/id}","deployments_url":"https://api.github.com/repos/TotalVerb/julia/deployments","created_at":"2016-04-14T02:29:35Z","updated_at":"2016-04-14T02:29:42Z","pushed_at":"2016-05-30T21:01:03Z","git_url":"git://github.com/TotalVerb/julia.git","ssh_url":"git@github.com:TotalVerb/julia.git","clone_url":"https://github.com/TotalVerb/julia.git","svn_url":"https://github.com/TotalVerb/julia","homepage":"http://julialang.org/","size":91556,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"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":"JuliaLang:master","ref":"master","sha":"2fa728aae4c80065805047c4ec9a403631211780","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaLang/julia/deployments","created_at":"2011-04-21T07:01:50Z","updated_at":"2016-05-30T22:15:19Z","pushed_at":"2016-05-30T22:08:55Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":386328,"stargazers_count":7084,"watchers_count":7084,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1636,"mirror_url":null,"open_issues_count":1794,"forks":1636,"open_issues":1794,"watchers":7084,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/16648"},"html":{"href":"https://github.com/JuliaLang/julia/pull/16648"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/16648"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/16648/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/16648/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/16648/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/3e63a0e4b5ec9c9a91dd2ab38c3bc64f34dd8493"}}}}
{"actor":{"display_login":"tkelman"}}