Skip to content

Commit 09489c3

Browse files
committed
merge 9.0: improve interpreter creation speed, if there is no zipfs tcl-library (avoid performance penalty [62019f8aa9f5ec73])
2 parents 5c3426d + d7c57a0 commit 09489c3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

generic/tclZipfs.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ static const char pwrot[17] =
398398
"\x00\x80\x40\xC0\x20\xA0\x60\xE0"
399399
"\x10\x90\x50\xD0\x30\xB0\x70\xF0";
400400

401+
static int zipfs_tcl_library_init = 0;
401402
static const char *zipfs_literal_tcl_library = NULL;
402403

403404
/* Function prototypes */
@@ -4339,6 +4340,7 @@ ScriptLibrarySetup(
43394340
Tcl_DecrRefCount(searchPathObj);
43404341
/* Bug [fccb9f322f]. Reinit system encoding after setting search path */
43414342
TclpSetInitialEncodings();
4343+
zipfs_tcl_library_init = 1;
43424344
return libDirObj;
43434345
}
43444346

@@ -4356,10 +4358,13 @@ TclZipfs_TclLibrary(void)
43564358

43574359
/*
43584360
* Use the cached value if that has been set; we don't want to repeat the
4359-
* searching and mounting.
4361+
* searching and mounting. Even if it is not found, see [62019f8aa9f5ec73].
43604362
*/
4361-
4362-
if (zipfs_literal_tcl_library) {
4363+
4364+
if (zipfs_tcl_library_init) {
4365+
if (!zipfs_literal_tcl_library) {
4366+
return NULL;
4367+
}
43634368
return ScriptLibrarySetup(zipfs_literal_tcl_library);
43644369
}
43654370

@@ -4416,6 +4421,11 @@ TclZipfs_TclLibrary(void)
44164421
if (zipfs_literal_tcl_library) {
44174422
return ScriptLibrarySetup(zipfs_literal_tcl_library);
44184423
}
4424+
/*
4425+
* No zipfs tcl-library, mark it to avoid performance penalty [62019f8aa9f5ec73],
4426+
* by future calls (child interpreters, threads, etc).
4427+
*/
4428+
zipfs_tcl_library_init = 1;
44194429
return NULL;
44204430
}
44214431

0 commit comments

Comments
 (0)