{"action":"opened","number":3,"pull_request":{"url":"https://api.github.com/repos/text-utf8/text/pulls/3","id":150153514,"html_url":"https://github.com/text-utf8/text/pull/3","diff_url":"https://github.com/text-utf8/text/pull/3.diff","patch_url":"https://github.com/text-utf8/text/pull/3.patch","issue_url":"https://api.github.com/repos/text-utf8/text/issues/3","number":3,"state":"open","locked":false,"title":"Fast reverse","user":{"login":"kuk0","id":733205,"avatar_url":"https://avatars1.githubusercontent.com/u/733205?v=4","gravatar_id":"","url":"https://api.github.com/users/kuk0","html_url":"https://github.com/kuk0","followers_url":"https://api.github.com/users/kuk0/followers","following_url":"https://api.github.com/users/kuk0/following{/other_user}","gists_url":"https://api.github.com/users/kuk0/gists{/gist_id}","starred_url":"https://api.github.com/users/kuk0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuk0/subscriptions","organizations_url":"https://api.github.com/users/kuk0/orgs","repos_url":"https://api.github.com/users/kuk0/repos","events_url":"https://api.github.com/users/kuk0/events{/privacy}","received_events_url":"https://api.github.com/users/kuk0/received_events","type":"User","site_admin":false},"body":"the original algorithm created a reversed stream and the UTF8 version was almost twice as slow;\r\nreverse implemented directly is actually faster and in the last commit i (optimistically) try to use bit parallelism and reverse 64bits (8 bytes) at a time (only applicable when all the code points are single bytes) - this is (unsurprisingly) much faster\r\ne.g. for the `ascii-small` data set:\r\n```\r\n2.636 ms   (2.629 ms .. 2.643 ms) -- UTF16\r\n4.951 ms   (4.941 ms .. 4.964 ms) -- UTF8 (v0, using streams as UTF16)\r\n1.650 ms   (1.646 ms .. 1.654 ms) -- no stream\r\n184.1 μs   (183.9 μs .. 184.3 μs) -- fast but incorrect algorithm\r\n193.8 μs   (192.6 μs .. 194.9 μs) -- deal with alignment\r\n213.7 μs   (213.4 μs .. 214.0 μs) -- check that all code points are single bytes\r\n```\r\n\r\nhere are benchmarks for other data sets:\r\n```\r\nUTF16 vs. UTF8 simple vs. UTF8 bit parallel:\r\n\r\nbenchmarking Pure/reverse/Text+tiny\r\ntime                 306.4 ns   (306.2 ns .. 306.7 ns)\r\ntime                 202.2 ns   (201.8 ns .. 202.6 ns)\r\ntime                 205.2 ns   (204.9 ns .. 205.6 ns)\r\nbenchmarking Pure/reverse/Text+ascii-small\r\ntime                 2.631 ms   (2.625 ms .. 2.639 ms)\r\ntime                 1.654 ms   (1.648 ms .. 1.658 ms)\r\ntime                 210.3 μs   (210.2 μs .. 210.4 μs)\r\nbenchmarking Pure/reverse/Text+ascii\r\ntime                 2.147 s    (2.101 s .. 2.225 s)\r\ntime                 1.298 s    (1.268 s .. 1.339 s)\r\ntime                 204.7 ms   (183.0 ms .. 236.4 ms)\r\nbenchmarking Pure/reverse/Text+english\r\ntime                 145.6 ms   (140.0 ms .. 149.7 ms)\r\ntime                 89.29 ms   (87.01 ms .. 91.77 ms)\r\ntime                 15.97 ms   (15.57 ms .. 16.54 ms)\r\nbenchmarking Pure/reverse/Text+russian\r\ntime                 224.4 μs   (224.2 μs .. 224.7 μs)\r\ntime                 195.5 μs   (195.3 μs .. 195.7 μs)\r\ntime                 236.9 μs   (236.8 μs .. 237.1 μs)\r\nbenchmarking Pure/reverse/Text+japanese\r\ntime                 154.8 μs   (154.6 μs .. 155.0 μs)\r\ntime                 161.5 μs   (161.4 μs .. 161.7 μs)\r\ntime                 178.5 μs   (178.4 μs .. 178.6 μs)\r\n```\r\n\r\nin `russian` almost all characters have 2 bytes in UTF8 and in `japanese` almost all have 3 bytes in UTF8 (but 1 word in UTF16, which is better in this case)\r\n\r\nTODO:\r\n- [ ] this only works for little endian architectures; add big endian\r\n- [ ]  32-bit version","created_at":"2017-11-01T21:40:36Z","updated_at":"2017-11-01T21:40:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/text-utf8/text/pulls/3/commits","review_comments_url":"https://api.github.com/repos/text-utf8/text/pulls/3/comments","review_comment_url":"https://api.github.com/repos/text-utf8/text/pulls/comments{/number}","comments_url":"https://api.github.com/repos/text-utf8/text/issues/3/comments","statuses_url":"https://api.github.com/repos/text-utf8/text/statuses/c2f8bd7e28d92de8335b71f2d1779af6f97dcd2f","head":{"label":"kuk0:fast-rev","ref":"fast-rev","sha":"c2f8bd7e28d92de8335b71f2d1779af6f97dcd2f","user":{"login":"kuk0","id":733205,"avatar_url":"https://avatars1.githubusercontent.com/u/733205?v=4","gravatar_id":"","url":"https://api.github.com/users/kuk0","html_url":"https://github.com/kuk0","followers_url":"https://api.github.com/users/kuk0/followers","following_url":"https://api.github.com/users/kuk0/following{/other_user}","gists_url":"https://api.github.com/users/kuk0/gists{/gist_id}","starred_url":"https://api.github.com/users/kuk0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuk0/subscriptions","organizations_url":"https://api.github.com/users/kuk0/orgs","repos_url":"https://api.github.com/users/kuk0/repos","events_url":"https://api.github.com/users/kuk0/events{/privacy}","received_events_url":"https://api.github.com/users/kuk0/received_events","type":"User","site_admin":false},"repo":{"id":52004577,"name":"text","full_name":"kuk0/text","owner":{"login":"kuk0","id":733205,"avatar_url":"https://avatars1.githubusercontent.com/u/733205?v=4","gravatar_id":"","url":"https://api.github.com/users/kuk0","html_url":"https://github.com/kuk0","followers_url":"https://api.github.com/users/kuk0/followers","following_url":"https://api.github.com/users/kuk0/following{/other_user}","gists_url":"https://api.github.com/users/kuk0/gists{/gist_id}","starred_url":"https://api.github.com/users/kuk0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuk0/subscriptions","organizations_url":"https://api.github.com/users/kuk0/orgs","repos_url":"https://api.github.com/users/kuk0/repos","events_url":"https://api.github.com/users/kuk0/events{/privacy}","received_events_url":"https://api.github.com/users/kuk0/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kuk0/text","description":"An efficient packed, immutable Unicode text type for Haskell, with a powerful loop fusion optimization framework. ","fork":true,"url":"https://api.github.com/repos/kuk0/text","forks_url":"https://api.github.com/repos/kuk0/text/forks","keys_url":"https://api.github.com/repos/kuk0/text/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuk0/text/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuk0/text/teams","hooks_url":"https://api.github.com/repos/kuk0/text/hooks","issue_events_url":"https://api.github.com/repos/kuk0/text/issues/events{/number}","events_url":"https://api.github.com/repos/kuk0/text/events","assignees_url":"https://api.github.com/repos/kuk0/text/assignees{/user}","branches_url":"https://api.github.com/repos/kuk0/text/branches{/branch}","tags_url":"https://api.github.com/repos/kuk0/text/tags","blobs_url":"https://api.github.com/repos/kuk0/text/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuk0/text/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuk0/text/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuk0/text/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuk0/text/statuses/{sha}","languages_url":"https://api.github.com/repos/kuk0/text/languages","stargazers_url":"https://api.github.com/repos/kuk0/text/stargazers","contributors_url":"https://api.github.com/repos/kuk0/text/contributors","subscribers_url":"https://api.github.com/repos/kuk0/text/subscribers","subscription_url":"https://api.github.com/repos/kuk0/text/subscription","commits_url":"https://api.github.com/repos/kuk0/text/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuk0/text/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuk0/text/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuk0/text/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuk0/text/contents/{+path}","compare_url":"https://api.github.com/repos/kuk0/text/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuk0/text/merges","archive_url":"https://api.github.com/repos/kuk0/text/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuk0/text/downloads","issues_url":"https://api.github.com/repos/kuk0/text/issues{/number}","pulls_url":"https://api.github.com/repos/kuk0/text/pulls{/number}","milestones_url":"https://api.github.com/repos/kuk0/text/milestones{/number}","notifications_url":"https://api.github.com/repos/kuk0/text/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuk0/text/labels{/name}","releases_url":"https://api.github.com/repos/kuk0/text/releases{/id}","deployments_url":"https://api.github.com/repos/kuk0/text/deployments","created_at":"2016-02-18T12:05:42Z","updated_at":"2016-02-18T12:05:43Z","pushed_at":"2017-11-01T21:26:15Z","git_url":"git://github.com/kuk0/text.git","ssh_url":"git@github.com:kuk0/text.git","clone_url":"https://github.com/kuk0/text.git","svn_url":"https://github.com/kuk0/text","homepage":"http://bitbucket.org/bos/text","size":2655,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"text-utf8:utf8","ref":"utf8","sha":"f6d207a9016fc9d3de37105fef3b088c30069ccc","user":{"login":"text-utf8","id":29595753,"avatar_url":"https://avatars0.githubusercontent.com/u/29595753?v=4","gravatar_id":"","url":"https://api.github.com/users/text-utf8","html_url":"https://github.com/text-utf8","followers_url":"https://api.github.com/users/text-utf8/followers","following_url":"https://api.github.com/users/text-utf8/following{/other_user}","gists_url":"https://api.github.com/users/text-utf8/gists{/gist_id}","starred_url":"https://api.github.com/users/text-utf8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/text-utf8/subscriptions","organizations_url":"https://api.github.com/users/text-utf8/orgs","repos_url":"https://api.github.com/users/text-utf8/repos","events_url":"https://api.github.com/users/text-utf8/events{/privacy}","received_events_url":"https://api.github.com/users/text-utf8/received_events","type":"Organization","site_admin":false},"repo":{"id":94981656,"name":"text","full_name":"text-utf8/text","owner":{"login":"text-utf8","id":29595753,"avatar_url":"https://avatars0.githubusercontent.com/u/29595753?v=4","gravatar_id":"","url":"https://api.github.com/users/text-utf8","html_url":"https://github.com/text-utf8","followers_url":"https://api.github.com/users/text-utf8/followers","following_url":"https://api.github.com/users/text-utf8/following{/other_user}","gists_url":"https://api.github.com/users/text-utf8/gists{/gist_id}","starred_url":"https://api.github.com/users/text-utf8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/text-utf8/subscriptions","organizations_url":"https://api.github.com/users/text-utf8/orgs","repos_url":"https://api.github.com/users/text-utf8/repos","events_url":"https://api.github.com/users/text-utf8/events{/privacy}","received_events_url":"https://api.github.com/users/text-utf8/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/text-utf8/text","description":"An efficient packed, immutable UTF8-backed Unicode text type for Haskell","fork":true,"url":"https://api.github.com/repos/text-utf8/text","forks_url":"https://api.github.com/repos/text-utf8/text/forks","keys_url":"https://api.github.com/repos/text-utf8/text/keys{/key_id}","collaborators_url":"https://api.github.com/repos/text-utf8/text/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/text-utf8/text/teams","hooks_url":"https://api.github.com/repos/text-utf8/text/hooks","issue_events_url":"https://api.github.com/repos/text-utf8/text/issues/events{/number}","events_url":"https://api.github.com/repos/text-utf8/text/events","assignees_url":"https://api.github.com/repos/text-utf8/text/assignees{/user}","branches_url":"https://api.github.com/repos/text-utf8/text/branches{/branch}","tags_url":"https://api.github.com/repos/text-utf8/text/tags","blobs_url":"https://api.github.com/repos/text-utf8/text/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/text-utf8/text/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/text-utf8/text/git/refs{/sha}","trees_url":"https://api.github.com/repos/text-utf8/text/git/trees{/sha}","statuses_url":"https://api.github.com/repos/text-utf8/text/statuses/{sha}","languages_url":"https://api.github.com/repos/text-utf8/text/languages","stargazers_url":"https://api.github.com/repos/text-utf8/text/stargazers","contributors_url":"https://api.github.com/repos/text-utf8/text/contributors","subscribers_url":"https://api.github.com/repos/text-utf8/text/subscribers","subscription_url":"https://api.github.com/repos/text-utf8/text/subscription","commits_url":"https://api.github.com/repos/text-utf8/text/commits{/sha}","git_commits_url":"https://api.github.com/repos/text-utf8/text/git/commits{/sha}","comments_url":"https://api.github.com/repos/text-utf8/text/comments{/number}","issue_comment_url":"https://api.github.com/repos/text-utf8/text/issues/comments{/number}","contents_url":"https://api.github.com/repos/text-utf8/text/contents/{+path}","compare_url":"https://api.github.com/repos/text-utf8/text/compare/{base}...{head}","merges_url":"https://api.github.com/repos/text-utf8/text/merges","archive_url":"https://api.github.com/repos/text-utf8/text/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/text-utf8/text/downloads","issues_url":"https://api.github.com/repos/text-utf8/text/issues{/number}","pulls_url":"https://api.github.com/repos/text-utf8/text/pulls{/number}","milestones_url":"https://api.github.com/repos/text-utf8/text/milestones{/number}","notifications_url":"https://api.github.com/repos/text-utf8/text/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/text-utf8/text/labels{/name}","releases_url":"https://api.github.com/repos/text-utf8/text/releases{/id}","deployments_url":"https://api.github.com/repos/text-utf8/text/deployments","created_at":"2017-06-21T08:31:41Z","updated_at":"2017-10-31T17:19:43Z","pushed_at":"2017-11-01T21:26:07Z","git_url":"git://github.com/text-utf8/text.git","ssh_url":"git@github.com:text-utf8/text.git","clone_url":"https://github.com/text-utf8/text.git","svn_url":"https://github.com/text-utf8/text","homepage":"https://github.com/text-utf8","size":2582,"stargazers_count":5,"watchers_count":5,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":5,"default_branch":"utf8"}},"_links":{"self":{"href":"https://api.github.com/repos/text-utf8/text/pulls/3"},"html":{"href":"https://github.com/text-utf8/text/pull/3"},"issue":{"href":"https://api.github.com/repos/text-utf8/text/issues/3"},"comments":{"href":"https://api.github.com/repos/text-utf8/text/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/text-utf8/text/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/text-utf8/text/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/text-utf8/text/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/text-utf8/text/statuses/c2f8bd7e28d92de8335b71f2d1779af6f97dcd2f"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":3,"additions":102,"deletions":6,"changed_files":2}}
{"actor":{"display_login":"kuk0"}}