{"action":"created","issue":{"url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1394","labels_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1394/labels{/name}","comments_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1394/comments","events_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1394/events","html_url":"https://github.com/ceylon/ceylon-spec/issues/1394","id":97841416,"number":1394,"title":"significant slowdown calculating complements","user":{"login":"jvasileff","id":236050,"avatar_url":"https://avatars.githubusercontent.com/u/236050?v=3","gravatar_id":"","url":"https://api.github.com/users/jvasileff","html_url":"https://github.com/jvasileff","followers_url":"https://api.github.com/users/jvasileff/followers","following_url":"https://api.github.com/users/jvasileff/following{/other_user}","gists_url":"https://api.github.com/users/jvasileff/gists{/gist_id}","starred_url":"https://api.github.com/users/jvasileff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvasileff/subscriptions","organizations_url":"https://api.github.com/users/jvasileff/orgs","repos_url":"https://api.github.com/users/jvasileff/repos","events_url":"https://api.github.com/users/jvasileff/events{/privacy}","received_events_url":"https://api.github.com/users/jvasileff/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-29T02:14:38Z","updated_at":"2015-07-29T11:13:59Z","closed_at":null,"body":"Narrowing operations involving several cases can be quite slow. Using the test program:\r\n\r\n```ceylon\r\nimport ceylon.ast.core {\r\n    Node\r\n}\r\n\r\nAnything slowness1(String|Node node)\r\n    =>  if (is String node) then null else null;\r\n    //{ if (is String node) { return null; } else { return node; }\r\n\r\nAnything slowness2(String|Node node)\r\n    =>  if (is String node) then null else null;\r\n    //{ if (is String node) { return null; } else { return node; }\r\n\r\nAnything slowness3(String|Node node)\r\n    =>  if (is String node) then null else null; \r\n    //{ if (is String node) { return null; } else { return node; }\r\n\r\nAnything slowness4(String|Node node)\r\n    =>  if (is String node) then null else null;\r\n    //{ if (is String node) { return null; } else { return node; }\r\n\r\nvoid load(Node n) {}            \r\n\r\nabstract class Foo() {}         \r\n\r\nabstract class Enum() of        \r\nA | B | C | D | E | F | G | H | I | J | \r\nK | L | M | N | O | P | Q | R | S | T {}\r\n\r\nclass A() extends Enum() {} class B() extends Enum() {}\r\nclass C() extends Enum() {} class D() extends Enum() {}\r\nclass E() extends Enum() {} class F() extends Enum() {}\r\nclass G() extends Enum() {} class H() extends Enum() {}\r\nclass I() extends Enum() {} class J() extends Enum() {}\r\nclass K() extends Enum() {} class L() extends Enum() {}\r\nclass M() extends Enum() {} class N() extends Enum() {}\r\nclass O() extends Enum() {} class P() extends Enum() {}\r\nclass Q() extends Enum() {} class R() extends Enum() {}\r\nclass S() extends Enum() {} class T() extends Enum() {}\r\n```\r\nI'm getting the following timings on my laptop:\r\n\r\n**`slownessx(String|Node)`** (as shown above)\r\n```\r\n$ time ceylon compile-js --suppress-warning\r\nNote: Created module simple/1.0.0\r\n\r\nreal\t0m24.732s\r\nuser\t0m32.355s\r\nsys\t0m0.610s\r\n```\r\n**`slownessx(String|Enum)`**\r\n```\r\n$ time ceylon compile-js --suppress-warning\r\nNote: Created module simple/1.0.0\r\n\r\nreal\t0m3.796s\r\nuser\t0m9.294s\r\nsys\t0m0.295s\r\n```\r\n**`slownessx(String|Foo)`**\r\n```\r\n$ time ceylon compile-js --suppress-warning\r\nNote: Created module simple/1.0.0\r\n\r\nreal\t0m1.872s\r\nuser\t0m4.039s\r\nsys\t0m0.232s\r\n```\r\n\r\nAnd with the `slownessx` functions commented out:\r\n```\r\n$ time ceylon compile-js --suppress-warning\r\nNote: Created module simple/1.0.0\r\n\r\nreal\t0m1.788s\r\nuser\t0m3.924s\r\nsys\t0m0.226s\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/comments/125921590","html_url":"https://github.com/ceylon/ceylon-spec/issues/1394#issuecomment-125921590","issue_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1394","id":125921590,"user":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"created_at":"2015-07-29T11:13:59Z","updated_at":"2015-07-29T11:13:59Z","body":"@jvasileff if this is a problem that only occurs in recent builds, would you please try changing the impl of `Type.isExactlyNothing()` to just `return isNothing()` and see if that affects anything."}}