{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/crypto/issues/5","labels_url":"https://api.github.com/repos/dart-lang/crypto/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/crypto/issues/5/comments","events_url":"https://api.github.com/repos/dart-lang/crypto/issues/5/events","html_url":"https://github.com/dart-lang/crypto/issues/5","id":85647908,"number":5,"title":"Abysmal performance for hash algorithms in dart:crypto","user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/crypto/labels/AssumedStale","name":"AssumedStale","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/crypto/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/dart-lang/crypto/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"madsager","id":2909286,"avatar_url":"https://avatars.githubusercontent.com/u/2909286?v=3","gravatar_id":"","url":"https://api.github.com/users/madsager","html_url":"https://github.com/madsager","followers_url":"https://api.github.com/users/madsager/followers","following_url":"https://api.github.com/users/madsager/following{/other_user}","gists_url":"https://api.github.com/users/madsager/gists{/gist_id}","starred_url":"https://api.github.com/users/madsager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madsager/subscriptions","organizations_url":"https://api.github.com/users/madsager/orgs","repos_url":"https://api.github.com/users/madsager/repos","events_url":"https://api.github.com/users/madsager/events{/privacy}","received_events_url":"https://api.github.com/users/madsager/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-06-05T22:31:12Z","updated_at":"2015-06-05T22:31:13Z","closed_at":null,"body":"_Originally opened as dart-lang/sdk#4611_\n\n*This issue was originally filed by dha...&#064;google.com*\n_____\nTest code:\nnew File('recordroyale.ogg').readAsBytes().then((buf) {\n&nbsp;&nbsp;var md5 = new MD5();\n&nbsp;&nbsp;md5.update(buf);\n&nbsp;&nbsp;print(md5.digest());\n});\n\nwhere 'recordroyale.ogg' is about six megabytes. This takes 22 seconds on my machine. Shelling out to md5sum(1) takes under 0.02 seconds. I understand that Dart won't ever be as fast as C, but with this disparity, the hash algorithms should be implemented in C[++] rather than Dart.\n\nI had a vague suspicion that this was slow due to unnecessary allocations, but the allocations are mostly small and consumed quickly. Refactoring to eliminate unnecessary allocations resulted in no change.\n\nMy use case involved checksumming a byte array that existed only in memory at the relevant location; it is far less convenient to write data to a temporary file, shell out to md5sum(1), then delete that file."},"comment":{"url":"https://api.github.com/repos/dart-lang/crypto/issues/comments/109465515","html_url":"https://github.com/dart-lang/crypto/issues/5#issuecomment-109465515","issue_url":"https://api.github.com/repos/dart-lang/crypto/issues/5","id":109465515,"user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T22:31:13Z","updated_at":"2015-06-05T22:31:13Z","body":"<a href=\"https://github.com/madsager\"><img src=\"https://avatars.githubusercontent.com/u/2909286?v=3\" align=\"left\" width=\"48\" height=\"48\"hspace=\"10\"></img></a> **Comment by [madsager](https://github.com/madsager)**\n\n----\n\nThere is a lot that can be done to improve performance here. The data is being copied around way too much. Also, the code overflows smi range and (at least it used to be the case that) a lot of the medium-size integer operations ended up in runtime calls. \n______\n cc @iposva-google.\n cc @sgmitrovic.\n"}}