]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.269
- updated to 7.2.330
[packages/vim.git] / 7.2.269
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.269
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.269
11 Problem:    Many people struggle to find out why Vim startup is slow.
12 Solution:   Add the --startuptime command line flag.
13 Files:      runtime/doc/starting.txt, src/globals.h, src/feature.h,
14             src/main.c, src/macros.h
15
16
17 *** ../vim-7.2.268/runtime/doc/starting.txt     2008-11-09 13:43:25.000000000 +0100
18 --- runtime/doc/starting.txt    2009-10-25 11:57:51.000000000 +0100
19 ***************
20 *** 144,149 ****
21 --- 144,156 ----
22                         -u NORC                 no                  yes
23                         --noplugin              yes                 no
24   
25 + --startuptime={fname}                                 *--startuptime*
26 +               During startup write timing messages to the file {fname}.
27 +               This can be used to find out where time is spent while loading
28 +               your .vimrc and plugins.
29 +               When {fname} already exists new messages are appended.
30 +               {only when compiled with this feature}
31
32                                                         *--literal*
33   --literal     Take file names literally, don't expand wildcards.  Not needed
34                 for Unix, because Vim always takes file names literally (the
35 ***************
36 *** 471,476 ****
37 --- 487,493 ----
38                 window title and copy/paste using the X clipboard.  This
39                 avoids a long startup time when running Vim in a terminal
40                 emulator and the connection to the X server is slow.
41 +               See |--startuptime| to find out if affects you.
42                 Only makes a difference on Unix or VMS, when compiled with the
43                 |+X11| feature.  Otherwise it's ignored.
44                 To disable the connection only for specific terminals, see the
45 *** ../vim-7.2.268/src/globals.h        2009-07-29 12:09:49.000000000 +0200
46 --- src/globals.h       2009-10-10 15:14:31.000000000 +0200
47 ***************
48 *** 1567,1572 ****
49 --- 1567,1576 ----
50   /* For undo we need to know the lowest time possible. */
51   EXTERN time_t starttime;
52   
53 + #ifdef STARTUPTIME
54 + EXTERN FILE *time_fd INIT(= NULL);  /* where to write startup timing */
55 + #endif
56
57   /*
58    * Some compilers warn for not using a return value, but in some situations we
59    * can't do anything useful with the value.  Assign to this variable to avoid
60 *** ../vim-7.2.268/src/feature.h        2008-11-09 13:43:25.000000000 +0100
61 --- src/feature.h       2009-10-10 16:16:19.000000000 +0200
62 ***************
63 *** 844,853 ****
64   /* #define DEBUG */
65   
66   /*
67 !  * STARTUPTIME                Time the startup process.  Writes a "vimstartup" file
68 !  *                    with timestamps.
69    */
70 ! /* #define STARTUPTIME "vimstartup" */
71   
72   /*
73    * MEM_PROFILE                Debugging of memory allocation and freeing.
74 --- 844,857 ----
75   /* #define DEBUG */
76   
77   /*
78 !  * STARTUPTIME                Time the startup process.  Writes a file with
79 !  *                    timestamps.
80    */
81 ! #if defined(FEAT_NORMAL) \
82 !       && ((defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)) \
83 !               || defined(WIN3264))
84 ! # define STARTUPTIME 1
85 ! #endif
86   
87   /*
88    * MEM_PROFILE                Debugging of memory allocation and freeing.
89 *** ../vim-7.2.268/src/main.c   2009-05-26 22:58:43.000000000 +0200
90 --- src/main.c  2009-10-10 16:18:32.000000000 +0200
91 ***************
92 *** 130,139 ****
93   #endif
94   
95   
96 - #ifdef STARTUPTIME
97 - static FILE *time_fd = NULL;
98 - #endif
99
100   /*
101    * Different types of error messages.
102    */
103 --- 130,135 ----
104 ***************
105 *** 173,178 ****
106 --- 169,177 ----
107       char_u    *fname = NULL;          /* file name from command line */
108       mparm_T   params;                 /* various parameters passed between
109                                          * main() and other functions. */
110 + #ifdef STARTUPTIME
111 +     int               i;
112 + #endif
113   
114       /*
115        * Do any system-specific initialisations.  These can NOT use IObuff or
116 ***************
117 *** 203,210 ****
118   #endif
119   
120   #ifdef STARTUPTIME
121 !     time_fd = mch_fopen(STARTUPTIME, "a");
122 !     TIME_MSG("--- VIM STARTING ---");
123   #endif
124       starttime = time(NULL);
125   
126 --- 202,216 ----
127   #endif
128   
129   #ifdef STARTUPTIME
130 !     for (i = 1; i < argc; ++i)
131 !     {
132 !       if (STRNICMP(argv[i], "--startuptime=", 14) == 0)
133 !       {
134 !           time_fd = mch_fopen(argv[i] + 14, "a");
135 !           TIME_MSG("--- VIM STARTING ---");
136 !           break;
137 !       }
138 !     }
139   #endif
140       starttime = time(NULL);
141   
142 ***************
143 *** 1150,1155 ****
144 --- 1156,1173 ----
145             cursor_on();
146   
147             do_redraw = FALSE;
148
149 + #ifdef STARTUPTIME
150 +           /* Now that we have drawn the first screen all the startup stuff
151 +            * has been done, close any file for startup messages. */
152 +           if (time_fd != NULL)
153 +           {
154 +               TIME_MSG("first screen update");
155 +               TIME_MSG("--- VIM STARTED ---");
156 +               fclose(time_fd);
157 +               time_fd = NULL;
158 +           }
159 + #endif
160         }
161   #ifdef FEAT_GUI
162         if (need_mouse_correct)
163 ***************
164 *** 1743,1748 ****
165 --- 1761,1770 ----
166                     /* already processed, skip */
167                 }
168   #endif
169 +               else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0)
170 +               {
171 +                   /* already processed, skip */
172 +               }
173                 else
174                 {
175                     if (argv[0][argv_idx])
176 ***************
177 *** 3211,3216 ****
178 --- 3233,3252 ----
179   
180   static struct timeval prev_timeval;
181   
182 + # ifdef WIN3264
183 + /*
184 +  * Windows doesn't have gettimeofday(), although it does have struct timeval.
185 +  */
186 +     static int
187 + gettimeofday(struct timeval *tv, char *dummy)
188 + {
189 +     long t = clock();
190 +     tv->tv_sec = t / CLOCKS_PER_SEC;
191 +     tv->tv_usec = (t - tv->tv_sec * CLOCKS_PER_SEC) * 1000000 / CLOCKS_PER_SEC;
192 +     return 0;
193 + }
194 + # endif
195
196   /*
197    * Save the previous time before doing something that could nest.
198    * set "*tv_rel" to the time elapsed so far.
199 ***************
200 *** 3299,3318 ****
201       }
202   }
203   
204 - # ifdef WIN3264
205 - /*
206 -  * Windows doesn't have gettimeofday(), although it does have struct timeval.
207 -  */
208 -     int
209 - gettimeofday(struct timeval *tv, char *dummy)
210 - {
211 -     long t = clock();
212 -     tv->tv_sec = t / CLOCKS_PER_SEC;
213 -     tv->tv_usec = (t - tv->tv_sec * CLOCKS_PER_SEC) * 1000000 / CLOCKS_PER_SEC;
214 -     return 0;
215 - }
216 - # endif
217
218   #endif
219   
220   #if defined(FEAT_CLIENTSERVER) || defined(PROTO)
221 --- 3335,3340 ----
222 *** ../vim-7.2.268/src/macros.h 2009-05-17 13:30:58.000000000 +0200
223 --- src/macros.h        2009-10-10 15:19:07.000000000 +0200
224 ***************
225 *** 243,249 ****
226   #endif
227   
228   #ifdef STARTUPTIME
229 ! # define TIME_MSG(s) time_msg(s, NULL)
230   #else
231   # define TIME_MSG(s)
232   #endif
233 --- 243,249 ----
234   #endif
235   
236   #ifdef STARTUPTIME
237 ! # define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); }
238   #else
239   # define TIME_MSG(s)
240   #endif
241 *** ../vim-7.2.268/src/version.c        2009-11-03 11:43:05.000000000 +0100
242 --- src/version.c       2009-11-03 12:06:31.000000000 +0100
243 ***************
244 *** 678,679 ****
245 --- 678,681 ----
246   {   /* Add new patch number below this line */
247 + /**/
248 +     269,
249   /**/
250
251 -- 
252 BEDEVERE: Look!  It's the old man from scene 24 - what's he Doing here?
253 ARTHUR:   He is the keeper of the Bridge.  He asks each traveler five
254           questions ...
255 GALAHAD:  Three questions.
256                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
257
258  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
259 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
260 \\\        download, build and distribute -- http://www.A-A-P.org        ///
261  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.041464 seconds and 3 git commands to generate.