{"action":"created","issue":{"url":"https://api.github.com/repos/vim-jp/issues/issues/708","labels_url":"https://api.github.com/repos/vim-jp/issues/issues/708/labels{/name}","comments_url":"https://api.github.com/repos/vim-jp/issues/issues/708/comments","events_url":"https://api.github.com/repos/vim-jp/issues/issues/708/events","html_url":"https://github.com/vim-jp/issues/issues/708","id":59598113,"number":708,"title":"showmatch for ruby is too slow","user":{"login":"koron","id":468368,"avatar_url":"https://avatars.githubusercontent.com/u/468368?v=3","gravatar_id":"","url":"https://api.github.com/users/koron","html_url":"https://github.com/koron","followers_url":"https://api.github.com/users/koron/followers","following_url":"https://api.github.com/users/koron/following{/other_user}","gists_url":"https://api.github.com/users/koron/gists{/gist_id}","starred_url":"https://api.github.com/users/koron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koron/subscriptions","organizations_url":"https://api.github.com/users/koron/orgs","repos_url":"https://api.github.com/users/koron/repos","events_url":"https://api.github.com/users/koron/events{/privacy}","received_events_url":"https://api.github.com/users/koron/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vim-jp/issues/labels/kind/bug","name":"kind/bug","color":"e10c02"},{"url":"https://api.github.com/repos/vim-jp/issues/labels/kind/performance","name":"kind/performance","color":"e10c02"},{"url":"https://api.github.com/repos/vim-jp/issues/labels/related/kaoriya","name":"related/kaoriya","color":"02e10c"},{"url":"https://api.github.com/repos/vim-jp/issues/labels/related/windows","name":"related/windows","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-03-03T05:47:08Z","updated_at":"2015-03-03T14:01:06Z","closed_at":null,"body":"gvim +kaoriya 7.4.648 (+ruby/dyn だけど Ruby 自体のpathが通ってないので、利用不可)\r\n\r\n`showmatch` を設定 & `syntax on` にした状態で、以下の内容の ruby ファイル を開きカーソルを動かすと、カーソルがカッコの上に重なる時=showmatchが稼働する時に、明らかに遅くなる。\r\n\r\n```ruby\r\ndef foo\r\n  return call_very_long_long_long_long_long_long_long_long_long_long_long_long_func({\r\n                                                                                      aaa: 111,\r\n                                                                                      bbb: 222,\r\n                                                                                      ccc: 333,\r\n                                                                                      ddd: 444,\r\n                                                                                      eee: 555,\r\n                                                                                      fff: 666,\r\n  })\r\nend\r\n```\r\n\r\nポイントはインデントが深い、もしくは1行が長いことだと推測される。その根拠として、以下の、内容は一緒だがインデントが浅い、ファイルに対して同様の操作を行なっても、この問題は発生しない。\r\n\r\n```ruby\r\ndef foo\r\n  return call_very_long_long_long_long_long_long_long_long_long_long_long_long_func({\r\n    aaa: 111,\r\n    bbb: 222,\r\n    ccc: 333,\r\n    ddd: 444,\r\n    eee: 555,\r\n    fff: 666,\r\n  })\r\nend\r\n```\r\n\r\n付け加えて、以下のようにJavaScriptでインデントの深いファイルに対しては問題が発生しないことから、ruby(ftplugin or syntax?)特有の問題であると推測される。\r\n\r\n```javascript\r\nfunction foo() {\r\n  return call_very_long_long_long_long_long_long_long_long_long_long_long_long_func({\r\n                                                                                      aaa: 111,\r\n                                                                                      bbb: 222,\r\n                                                                                      ccc: 333,\r\n                                                                                      ddd: 444,\r\n                                                                                      eee: 555,\r\n                                                                                      fff: 666\r\n  });\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/vim-jp/issues/issues/comments/76949803","html_url":"https://github.com/vim-jp/issues/issues/708#issuecomment-76949803","issue_url":"https://api.github.com/repos/vim-jp/issues/issues/708","id":76949803,"user":{"login":"todashuta","id":1555633,"avatar_url":"https://avatars.githubusercontent.com/u/1555633?v=3","gravatar_id":"","url":"https://api.github.com/users/todashuta","html_url":"https://github.com/todashuta","followers_url":"https://api.github.com/users/todashuta/followers","following_url":"https://api.github.com/users/todashuta/following{/other_user}","gists_url":"https://api.github.com/users/todashuta/gists{/gist_id}","starred_url":"https://api.github.com/users/todashuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todashuta/subscriptions","organizations_url":"https://api.github.com/users/todashuta/orgs","repos_url":"https://api.github.com/users/todashuta/repos","events_url":"https://api.github.com/users/todashuta/events{/privacy}","received_events_url":"https://api.github.com/users/todashuta/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T14:01:06Z","updated_at":"2015-03-03T14:01:06Z","body":"`:syntime`で調べてみました。\r\n\r\n```\r\n  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN\r\n  0.180515   9      0       0.034964    0.020057  rubyPredefinedConstant \\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(STD\r\nERR\r\n  0.146247   9      0       0.027419    0.016250  rubyPredefinedConstant \\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(Mat\r\nchi\r\n  0.112675   9      0       0.019565    0.012519  rubyPredefinedConstant \\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(DAT\r\nA\\|\r\n  0.083423   9      0       0.018985    0.009269  rubyPredefinedConstant \\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(RUB\r\nY_\\\r\n  0.009272   15     6       0.009075    0.000618  rubySymbol         []})\\\"':]\\@<!\\%(\\h\\|[^\\x00-\\x7F]\\)\\%(\\w\\|[\r\n  0.002593   15     6       0.002023    0.000173  rubySymbol         \\%([{(,]\\_s*\\)\\@<=\\l\\w*[!?]\\=::\\@!\r\n  0.000317   15     6       0.000069    0.000021  rubySymbol         \\%([{(,]\\_s*\\)\\@<=[[:space:],{]\\l\\w*[!?]\\=\r\n  0.000202   9      0       0.000044    0.000022  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(not\\|or\\|redo\r\n\r\n  0.000185   9      0       0.000036    0.000021  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(public\\|requi\r\n\r\n  0.000184   21     12      0.000037    0.000009  rubyInteger        \\%(\\%(\\w\\|[]})\\\"']\\s*\\)\\@<!-\\)\\=\\<\\%(0[dD]\r\n  0.000180   9      0       0.000045    0.000020  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(load\\|loop\\|p\r\n\r\n  0.000180   9      0       0.000038    0.000020  rubyConstant       \\%(\\%([.@$]\\@<!\\.\\)\\@<!\\<\\|::\\)\\_s*\\zs\\u\\w\r\n  0.000175   9      0       0.000042    0.000019  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(extend\\|fail\\\r\n\r\n  0.000173   9      0       0.000030    0.000019  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(elsif\\|end\\|e\r\n\r\n  0.000171   9      0       0.000031    0.000019  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(alias\\|and\\|b\r\n\r\n  0.000170   9      0       0.000032    0.000019  rubyKeywordAsMethod \\%(\\%(\\.\\@<!\\.\\)\\|::\\)\\_s*\\%(undef\\|unless\r\n\r\n-- More --\r\n```\r\n\r\nsytax/ruby.vim (https://github.com/vim-jp/vim/blob/a2e15c376747f7309e204f2c247142a77f66611e/runtime/syntax/ruby.vim#L120-L122\r\n)\r\n\r\n```vim\r\nsyn match rubyPredefinedConstant \"\\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(MatchingData\\|ARGF\\|ARGV\\|ENV\\)\\>\\%(\\s*(\\)\\@!\"\r\nsyn match rubyPredefinedConstant \"\\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(DATA\\|FALSE\\|NIL\\)\\>\\%(\\s*(\\)\\@!\"\r\nsyn match rubyPredefinedConstant \"\\%(\\%(\\.\\@<!\\.\\)\\@<!\\|::\\)\\_s*\\zs\\%(STDERR\\|STDIN\\|STDOUT\\|TOPLEVEL_BINDING\\|TRUE\\)\\>\\%(\\s*(\\)\\@!\"\r\n```\r\n\r\nこの3つで時間がかかっているようです。\r\n\r\nで、vim-ruby のコミットをみると、これらのパターンに変更(改善?)が入ってて、最新のもので試したところ、こちらの環境では改善されているのが確認できました。\r\n\r\nhttps://github.com/vim-ruby/vim-ruby/commit/b60da6c63bba329aa0327a2859639f9a02afc3ed"}}