Mercurial > hg
annotate contrib/vim/hgtest.vim @ 25344:ceaf04bb14ff
revset: add fast path for _list() of integer revisions
This can greatly speed up chained 'or' of integer revisions.
1) reduce nesting of chained 'or' operations
2) optimize to a list
3) fast path for integer revisions (this patch)
revset #0: 0 + 1 + 2 + ... + 1000
1) wall 0.483341 comb 0.480000 user 0.480000 sys 0.000000 (best of 20)
2) wall 0.025393 comb 0.020000 user 0.020000 sys 0.000000 (best of 107)
3) wall 0.008371 comb 0.000000 user 0.000000 sys 0.000000 (best of 317)
revset #1: sort(0 + 1 + 2 + ... + 1000)
1) wall 0.035240 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
2) wall 0.026432 comb 0.030000 user 0.030000 sys 0.000000 (best of 102)
3) wall 0.008418 comb 0.000000 user 0.000000 sys 0.000000 (best of 322)
revset #2: first(0 + 1 + 2 + ... + 1000)
1) wall 0.028949 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
2) wall 0.025503 comb 0.030000 user 0.030000 sys 0.000000 (best of 106)
3) wall 0.008423 comb 0.010000 user 0.010000 sys 0.000000 (best of 319)
But I admit that it is still slower than the spanset.
revset #3: 0:1000
3) wall 0.000132 comb 0.000000 user 0.000000 sys 0.000000 (best of 19010)
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 17 May 2015 15:16:13 +0900 |
parents | 6db1642288c0 |
children |
rev | line source |
---|---|
12509
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
1 " Vim syntax file |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
2 " Language: Mercurial unified tests |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
3 " Author: Steve Losh (steve@stevelosh.com) |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
4 " |
18052
6db1642288c0
contrib: state explicitly how hgtest.vim can be installed
Mads Kiilerich <madski@unity3d.com>
parents:
12509
diff
changeset
|
5 " Place this file in ~/.vim/syntax/ and add the following line to your |
6db1642288c0
contrib: state explicitly how hgtest.vim can be installed
Mads Kiilerich <madski@unity3d.com>
parents:
12509
diff
changeset
|
6 " ~/.vimrc to enable: |
12509
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
7 " au BufNewFile,BufRead *.t set filetype=hgtest |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
8 " |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
9 " If you want folding you'll need the following line as well: |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
10 " let hgtest_fold=1 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
11 " |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
12 " You might also want to set the starting foldlevel for hgtest files: |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
13 " autocmd Syntax hgtest setlocal foldlevel=1 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
14 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
15 if exists("b:current_syntax") |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
16 finish |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
17 endif |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
18 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
19 syn include @Shell syntax/sh.vim |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
20 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
21 syn match hgtestComment /^[^ ].*$/ |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
22 syn region hgtestOutput start=/^ [^$>]/ start=/^ $/ end=/\v.(\n\n*[^ ])\@=/me=s end=/^ [$>]/me=e-3 end=/^$/ fold containedin=hgtestBlock |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
23 syn match hgtestCommandStart /^ \$ / containedin=hgtestCommand |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
24 syn region hgtestCommand start=/^ \$ /hs=s+4,rs=s+4 end=/^ [^>]/me=e-3 end=/^ $/me=e-2 containedin=hgtestBlock contains=@Shell keepend |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
25 syn region hgtestBlock start=/^ /ms=e-2 end=/\v.(\n\n*[^ ])\@=/me=s end=/^$/me=e-1 fold keepend |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
26 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
27 hi link hgtestCommandStart Keyword |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
28 hi link hgtestComment Normal |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
29 hi link hgtestOutput Comment |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
30 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
31 if exists("hgtest_fold") |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
32 setlocal foldmethod=syntax |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
33 endif |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
34 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
35 syn sync match hgtestSync grouphere NONE "^$" |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
36 syn sync maxlines=200 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
37 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
38 " It's okay to set tab settings here, because an indent of two spaces is specified |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
39 " by the file format. |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
40 setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
41 |
4746a2e4b239
contrib/vim: add a syntax file for unified tests
Steve Losh <steve@stevelosh.com>
parents:
diff
changeset
|
42 let b:current_syntax = "hgtest" |