Skip to content

Commit 563a60a

Browse files
committed
speed up startup and shutdown of nip4-batch
1 parent bc0d4ec commit 563a60a

File tree

5 files changed

+25
-37
lines changed

5 files changed

+25
-37
lines changed

TODO

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
- main_shutdown() takes a LONG time
2-
3-
can we just del temp files maybe? just call vips_shutdown()?
4-
5-
- stop menu loading when we're not in workspace mode?
6-
7-
or maybe we do this already?
8-
91
- add tab completion ... somewhat like VS intellisense
102

113
should work in workspace entry box, and in program window

src/main-batch.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,10 @@ main(int argc, char **argv)
417417
if (main_option_test)
418418
main_option_verbose = TRUE;
419419

420-
if (main_option_i18n)
421-
/* We'll need to load all menus.
422-
*/
420+
/* We'll need to load all menus for workspace mode, or to gen i18n.
421+
*/
422+
if (main_option_i18n ||
423+
main_option_workspace)
423424
main_option_no_load_menus = FALSE;
424425

425426
/* On Windows, argv is ascii-only ... use this to get a utf-8 version of

src/main.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,17 @@ main_mkdir(const char *dir)
127127
static void *
128128
main_load_def(const char *filename)
129129
{
130-
Toolkit *kit;
130+
g_autofree char *basename = g_path_get_basename(filename);
131131

132-
if (!(kit = toolkit_new_from_file(main_toolkitgroup, filename)))
133-
error_alert(NULL);
134-
else
135-
filemodel_set_auto_load(FILEMODEL(kit));
132+
if (!main_option_no_load_menus ||
133+
basename[0] == '_') {
134+
Toolkit *kit;
135+
136+
if (!(kit = toolkit_new_from_file(main_toolkitgroup, filename)))
137+
error_alert(NULL);
138+
else
139+
filemodel_set_auto_load(FILEMODEL(kit));
140+
}
136141

137142
return NULL;
138143
}
@@ -398,6 +403,10 @@ main_startup(int argc, char **argv)
398403
void
399404
main_shutdown(void)
400405
{
406+
#ifdef DEBUG
407+
/* Do a careful shutdown (very slow) in DEBUG
408+
*/
409+
401410
/* Junk all symbols. This may remove a bunch of intermediate images
402411
* too.
403412
*/
@@ -419,8 +428,13 @@ main_shutdown(void)
419428
*/
420429
VIPS_UNREF(main_imageinfogroup);
421430
heap_check_all_destroyed();
422-
vips_shutdown();
423431
managed_check_all_destroyed();
424432
util_check_all_destroyed();
425433
view_dump();
434+
#endif /*DEBUG*/
435+
436+
/* Can we leave files in tmp after ^C/^V?
437+
*/
438+
439+
vips_shutdown();
426440
}

src/main.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ extern Imageinfogroup *main_imageinfogroup;
2929
extern void *main_c_stack_base;
3030
extern const char *main_argv0;
3131

32-
extern gboolean main_option_time_save;
33-
extern gboolean main_option_profile;
3432
extern gboolean main_option_i18n;
35-
extern gboolean main_option_batch;
3633
extern gboolean main_option_no_load_menus;
34+
extern gboolean main_option_batch;
3735

3836
void set_prefix(const char *prefix);
3937
const char *get_prefix(void);

src/row.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,13 +1662,6 @@ row_recomp(Row *row)
16621662
{
16631663
Row *top_row = row->top_row;
16641664

1665-
static GTimer *recomp_timer = NULL;
1666-
1667-
if (!recomp_timer)
1668-
recomp_timer = g_timer_new();
1669-
1670-
g_timer_reset(recomp_timer);
1671-
16721665
/* Sort dirties into recomp order.
16731666
*/
16741667
row_recomp_sort(top_row);
@@ -1766,16 +1759,6 @@ row_recomp(Row *row)
17661759
(icontainer_map_fn) heapmodel_update_model, NULL))
17671760
expr_error_set(top_row->expr);
17681761

1769-
if (main_option_profile) {
1770-
char txt[100];
1771-
VipsBuf buf = VIPS_BUF_STATIC(txt);
1772-
Symbol *context = symbol_get_parent(top_row->ws->sym);
1773-
1774-
row_qualified_name_relative(context, top_row, &buf);
1775-
printf("%s\t%g\n", vips_buf_all(&buf),
1776-
g_timer_elapsed(recomp_timer, NULL));
1777-
}
1778-
17791762
#ifdef DEBUG
17801763
printf("row_recomp: value of ");
17811764
row_name_print(top_row);

0 commit comments

Comments
 (0)