Index: openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl,v diff -u -r1.55.2.3 -r1.55.2.4 --- openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 16 Sep 2015 09:18:55 -0000 1.55.2.3 +++ openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 27 Nov 2015 10:26:58 -0000 1.55.2.4 @@ -55,10 +55,20 @@ ad_proc -public ds_enabled_p {} { Returns true if developer-support facilities are enabled. } { + # + # On busy sites, frequent calls to [ds_enabled_p] leads to huge + # number of mutex locks for the nsv ds_properties. Therefore, + # cache its results in a per-thead variable. + # + if {[info exists ::__ds_enabled_p]} { + return $::ds_enabled_p + } if { ![nsv_exists ds_properties enabled_p] || ![nsv_get ds_properties enabled_p] } { - return 0 + set ::ds_enabled_p 0 + } else { + set ::ds_enabled_p 1 } - return 1 + return $::ds_enabled_p } ad_proc -public ds_collection_enabled_p {} { @@ -359,8 +369,7 @@ ad_proc -private ds_add { name args } { Sets a developer-support property for the current request. } { - - if { [ds_enabled_p] && [ds_collection_enabled_p] } { + if { [ds_enabled_p] && [ds_collection_enabled_p] } { if { [catch { nsv_exists ds_request . }] } { ns_log "Warning" "ds_request NSVs not initialized" return @@ -692,7 +701,6 @@ # variables, which are deleted automatically after every # request. # - set ::ds_enabled_p 1 if {[::ds_collection_enabled_p] } {set ::ds_collection_enabled_p 1} if {[::ds_profiling_enabled_p] } {set ::ds_profiling_enabled_p 1} if {[::ds_show_p]} {set ::ds_show_p 1} Index: openacs-4/packages/acs-developer-support/www/set.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/set.tcl,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/acs-developer-support/www/set.tcl 10 Sep 2015 08:21:24 -0000 1.3.2.1 +++ openacs-4/packages/acs-developer-support/www/set.tcl 27 Nov 2015 10:26:59 -0000 1.3.2.2 @@ -28,6 +28,7 @@ } ds { nsv_set ds_properties enabled_p $enabled_p + set ::ds_enabled_p $enabled_p } frag { nsv_set ds_properties page_fragment_cache_p $enabled_p