Issue with duplicate() and ConcurrentStore ObjectStore

I'm working w/a legacy app that uses duplicate() to copy the
Application scope into the Request scope to make the variables thread
safe, because there aren't locks in the appropriate place in the code
base.

While experimenting with implement CacheBox to start caching some
data, I noticed that all of the sudden there was a huge jump in
processing of each page request.

Having narrowed down the issue, I've found that the problem is running
the duplicate() method on a CacheFactory instance.

If I run the following code, the "copy" line can take anywhere from 2
to 200 seconds if I'm using ConcurrentStore ObjectStores.

<cfscript>
config =
createObject("component","cachebox.system.cache.config.CacheBoxConfig").init(expandPath("./
config.xml"));
Application.CacheBox =
createObject("component","cachebox.system.cache.CacheFactory").init(config);

// duplicate the object
copy = duplicate(Application.CacheBox);
</cfscript>

If I change to using ConcurrentSoftReferenceStore ObjectStores, then
there's virtually no performance hit (like 0-16ms.)

The problem exists in both CF8 and CF9.

I haven't dug to deeply into the ConcurrentStore source code, but is
this a known issue?

How much of a performance difference is there between ConcurrentStore
and ConcurrentSoftReferenceStore?

Since this is a dedicated app that runs on dedicated servers, I could
probably create the cache in the Server scope--but I always hate
putting stuff in there, it just feels dirty.

Sorry to tell you this but duplicating the application scope is a bad
bad bad thing. Especially with caches or objects in memory. Entire
object graphs need to be serialized and duplicated. I highly would
discourage it especially with any cache.