{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm/issues/27","repository_url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm","labels_url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm/issues/27/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm/issues/27/events","html_url":"https://github.com/rust-lang-nursery/rust-wasm/issues/27","id":289412157,"number":27,"title":"slice::sort_by and slice::unstable_sort_by have bad performance when targeting wasm","user":{"login":"fitzgen","id":74571,"avatar_url":"https://avatars2.githubusercontent.com/u/74571?v=4","gravatar_id":"","url":"https://api.github.com/users/fitzgen","html_url":"https://github.com/fitzgen","followers_url":"https://api.github.com/users/fitzgen/followers","following_url":"https://api.github.com/users/fitzgen/following{/other_user}","gists_url":"https://api.github.com/users/fitzgen/gists{/gist_id}","starred_url":"https://api.github.com/users/fitzgen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fitzgen/subscriptions","organizations_url":"https://api.github.com/users/fitzgen/orgs","repos_url":"https://api.github.com/users/fitzgen/repos","events_url":"https://api.github.com/users/fitzgen/events{/privacy}","received_events_url":"https://api.github.com/users/fitzgen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-01-17T21:01:25Z","updated_at":"2018-02-22T21:55:47Z","closed_at":"2018-02-22T19:33:29Z","author_association":"COLLABORATOR","body":"...but not when targeting native code.\r\n\r\nI am very confused.\r\n\r\nMy naive Quicksort outperforms them both by a couple orders of magnitude(!!!!!) regardless which browser it is executed in (which tells me this is a Rust/LLVM issue, not wasm engine issue). This Quicksort is *very* naive: it is not pattern defeating, nor optimistically using insertion sort for small and mostly sorted ranges, or any of the other things that the built-in sort is doing.\r\n\r\nhttps://github.com/fitzgen/source-map-mappings/blob/master/src/sort.rs\r\n\r\nIn fact, just replacing the custom `swap` routine with `core`'s `slice::swap` causes a huge slow down. Again, only with wasm, not native code. That makes no sense to me.\r\n\r\n* Why is this particular performance gap occurring?\r\n\r\n* In the more general case, how do we debug and profile these cases where `perf(wasm) != perf(native)` and seemingly irrelevant changes have large effects on performance?\r\n\r\n(I guess the first thing to do in this particular case is diff the disassembly and see how the emitted code differs? What other techniques do we have?)"},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm/issues/comments/367835688","html_url":"https://github.com/rust-lang-nursery/rust-wasm/issues/27#issuecomment-367835688","issue_url":"https://api.github.com/repos/rust-lang-nursery/rust-wasm/issues/27","id":367835688,"user":{"login":"mgattozzi","id":3514399,"avatar_url":"https://avatars3.githubusercontent.com/u/3514399?v=4","gravatar_id":"","url":"https://api.github.com/users/mgattozzi","html_url":"https://github.com/mgattozzi","followers_url":"https://api.github.com/users/mgattozzi/followers","following_url":"https://api.github.com/users/mgattozzi/following{/other_user}","gists_url":"https://api.github.com/users/mgattozzi/gists{/gist_id}","starred_url":"https://api.github.com/users/mgattozzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgattozzi/subscriptions","organizations_url":"https://api.github.com/users/mgattozzi/orgs","repos_url":"https://api.github.com/users/mgattozzi/repos","events_url":"https://api.github.com/users/mgattozzi/events{/privacy}","received_events_url":"https://api.github.com/users/mgattozzi/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T21:55:47Z","updated_at":"2018-02-22T21:55:47Z","author_association":"COLLABORATOR","body":"The mysteries of compilers and how no one is truly sure why things get fixed, they just do."}}
{"actor":{"display_login":"mgattozzi"}}