Skip to content

Terrible performance for long (JSON) lines #2

@andpol

Description

@andpol

I had some issues opening vim up a 500K-sized file, that contained only 4 lines, 2 of them being very long JSON strings objecst. I enabled VIM profiling and found out this plugin was the cause.

Here's the profile summary:

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
    1 204.214577             <SNR>7_DetectLogcat()
    4   0.019893             <SNR>59_Highlight_Matching_Pair()
    1   0.000886   0.000060  <SNR>47_BufEnterHook()
    1   0.000721   0.000193  344()
    1   0.000159   0.000032  363()
    3   0.000123             syntastic#util#fname2buf()
    9   0.000107   0.000070  syntastic#util#var()
    1   0.000088   0.000050  302()
    1   0.000068   0.000028  <SNR>47_BufWinEnterHook()
    1   0.000067   0.000018  <SNR>47_BufReadPostHook()
    1   0.000066   0.000008  270()
    7   0.000062   0.000047  syntastic#log#debug()
    1   0.000054   0.000023  307()
    1   0.000048   0.000029  271()
    2   0.000046   0.000015  362()
    2   0.000046   0.000023  273()
    1   0.000045             364()
    2   0.000038   0.000012  301()
    9   0.000037             syntastic#util#rawVar()
    2   0.000031   0.000012  297()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
    1            204.214577  <SNR>7_DetectLogcat()
    4              0.019893  <SNR>59_Highlight_Matching_Pair()
    1   0.000721   0.000193  344()
    3              0.000123  syntastic#util#fname2buf()
    9   0.000107   0.000070  syntastic#util#var()
    1   0.000886   0.000060  <SNR>47_BufEnterHook()
    1   0.000088   0.000050  302()
    7   0.000062   0.000047  syntastic#log#debug()
    1              0.000045  364()
    9              0.000037  syntastic#util#rawVar()
    1   0.000159   0.000032  363()
    1   0.000048   0.000029  271()
    1   0.000068   0.000028  <SNR>47_BufWinEnterHook()
    1   0.000030   0.000028  365()
    1              0.000027  ResetNumbers()
    1              0.000026  306()
    1   0.000054   0.000023  307()
    2   0.000046   0.000023  273()
    2              0.000022  syntastic#util#stamp()
    1   0.000067   0.000018  <SNR>47_BufReadPostHook()

and details about the logcat function:

FUNCTION  <SNR>7_DetectLogcat()
    Defined: ~/dotfiles/vim/bundle/vim-logcat/ftdetect/logcat.vim line 1
Called 1 time
Total time: 204.214577
 Self time: 204.214577

count  total (s)   self (s)
                            	" Detect from the 2nd line. The 1st line could be:
                            	" -------- beginning of system
    1            204.214568 	if line('$') > 1 && getline(2) =~# '.* [F|E|W|I|D|V] .*:.*'
                            		set filetype=logcat
    1              0.000001 	endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions