From 85801a4dbdee22f230637311681b8b03a72979db Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 6 Oct 2001 23:21:45 +0000 Subject: Rearrange fmgr.c and relcache so that it's possible to keep FmgrInfo lookup info in the relcache for index access method support functions. This makes a huge difference for dynamically loaded support functions, and should save a few cycles even for built-in ones. Also tweak dfmgr.c so that load_external_function is called only once, not twice, when doing fmgr_info for a dynamically loaded function. All per performance gripe from Teodor Sigaev, 5-Oct-01. --- src/pl/plpython/plpython.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/pl/plpython') diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index cd3486fa6d6..8dcfb1c970c 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -29,7 +29,7 @@ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.7 2001/10/04 15:45:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.8 2001/10/06 23:21:45 tgl Exp $ * ********************************************************************* */ @@ -308,18 +308,14 @@ volatile int func_leave_calls = 0; * data structures such as fmgr info records therefore must live forever * as well. A better implementation would store all this stuff in a per- * function memory context that could be reclaimed at need. In the meantime, - * fmgr_info must be called in TopMemoryContext so that whatever it might - * allocate, and whatever the eventual function might allocate using fn_mcxt, - * will live forever too. + * fmgr_info_cxt must be called specifying TopMemoryContext so that whatever + * it might allocate, and whatever the eventual function might allocate using + * fn_mcxt, will live forever too. */ static void perm_fmgr_info(Oid functionId, FmgrInfo *finfo) { - MemoryContext oldcontext; - - oldcontext = MemoryContextSwitchTo(TopMemoryContext); - fmgr_info(functionId, finfo); - MemoryContextSwitchTo(oldcontext); + fmgr_info_cxt(functionId, finfo, TopMemoryContext); } -- cgit v1.2.3