[interchange-cvs] interchange - jon modified lib/Vend/Dispatch.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri May 14 08:36:43 EDT 2004


User:      jon
Date:      2004-05-14 12:36:43 GMT
Modified:  lib/Vend Dispatch.pm
Log:
Use Tie::ShadowHash instead of copying %$Variable because it's much
faster for larger strings in Variables. Keep copying %$Pragma because it's
faster to copy than shadow when it's small.

Only protect %$Variable and %$Pragma when in PreFork or mod_perl mode;
it's unnecessary overhead in fork-on-demand mode. (Thanks, Mike.)

Revision  Changes    Path
1.41      +12 -4     interchange/lib/Vend/Dispatch.pm


rev 1.41, prev_rev 1.40
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -u -r1.40 -r1.41
--- Dispatch.pm	13 May 2004 22:41:22 -0000	1.40
+++ Dispatch.pm	14 May 2004 12:36:43 -0000	1.41
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.40 2004/05/13 22:41:22 jon Exp $
+# $Id: Dispatch.pm,v 1.41 2004/05/14 12:36:43 jon Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.40 $, 10);
+$VERSION = substr(q$Revision: 1.41 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -995,8 +995,16 @@
 		}
 	}
 
-	$::Variable = { %{ $Vend::Cfg->{Variable} } };
-	$::Pragma   = { %{ $Vend::Cfg->{Pragma} } };
+	if ($Global::Foreground) {
+		my %hash;
+		tie %hash, 'Tie::ShadowHash', $Vend::Cfg->{Variable};
+		$::Variable = \%hash;
+		$::Pragma = { %{ $Vend::Cfg->{Pragma} } };
+	}
+	else {
+		$::Variable = $Vend::Cfg->{Variable};
+		$::Pragma = $Vend::Cfg->{Pragma};
+	}
 
 	my $mt;
 	if($Vend::Cfg->{DeliverImage}








More information about the interchange-cvs mailing list