def deep_dup(obj)
      if obj.is_a?(Hash)
        result = {}
        obj.each { |k,v| result[k] = deep_dup(v) }
        result
      elsif obj.is_a?(Array)
        obj.map { |el| deep_dup(el) }
      else
        dup_or_self(obj)
      end
    end
def deep_dup(obj)
      if obj.is_a?(Hash)
        result = {}
        obj.each { |k,v| result[k] = deep_dup(v) }
        result
      elsif obj.is_a?(Array)
        obj.map { |el| deep_dup(el) }
      else
        dup_or_self(obj)
      end
    end
Will recursively deep dup an aribitrary set of nested hashes and arrays,
 but does not handle complex objects.  Also, this benchmarked *way* faster
 than the Marshal approach.