Benchmark to measure deserializing objects by hand
439601
public void timeBagOfPrimitivesStreaming(int reps) throws IOException {
    for (int i=0; i<reps; ++i) {
      StringReader reader = new StringReader(json);
      JsonReader jr = new JsonReader(reader);
      jr.beginObject();
      long longValue = 0;
      int intValue = 0;
      boolean booleanValue = false;
      String stringValue = null;
      while(jr.hasNext()) {
        String name = jr.nextName();
        if (name.equals("longValue")) {
          longValue = jr.nextLong();
        } else if (name.equals("intValue")) {
          intValue = jr.nextInt();
        } else if (name.equals("booleanValue")) {
          booleanValue = jr.nextBoolean();
        } else if (name.equals("stringValue")) {
          stringValue = jr.nextString();
        } else {
          throw new IOException("Unexpected name: " + name);
        }
      }
      jr.endObject();
      new BagOfPrimitives(longValue, intValue, booleanValue, stringValue);
    }
  }
833676
def fast_deepcopy(obj):
    
    with BytesIO() as buf:
        pickle.dump(obj, buf)
        buf.seek(0)
        obj_new = pickle.load(buf)
    return obj_new
860124
def deserialize(klass, data):
    
    handler = DESERIALIZE_REGISTRY.get(klass)
    if handler:
        return handler(data)
    raise TypeError("There is no deserializer registered to handle "
                    "instances of '{}'".format(klass.__name__))
1138209
def _deserialize_dict(data, boxed_type):
    
    return {k: _deserialize(v, boxed_type)
            for k, v in six.iteritems(data)}
1249422
function deserializeDHInnerData(context) {
    var decryptedDHParamsWithHash = context.decryptedDHParams;
    if (logger.isDebugEnabled()) {
        logger.debug('decryptedDHParamsWithHash(%s) = %s', decryptedDHParamsWithHash.length, decryptedDHParamsWithHash.toString('hex'));
    }
    var decryptedDHParams = decryptedDHParamsWithHash.slice(20, 564 + 20);
    if (logger.isDebugEnabled()) {
        logger.debug('decryptedDHParams(%s) = %s', decryptedDHParams.length, decryptedDHParams.toString('hex'));
    }
    var serverDHInnerData = new mtproto.type.Server_DH_inner_data({
        buffer: decryptedDHParams
    }).deserialize();
    if (logger.isDebugEnabled()) {
        logger.debug('serverDHInnerData = %s obtained in %sms', serverDHInnerData.toPrintable(), context.reqDHDuration);
    }
    // Check if the nonces are consistent
    if (serverDHInnerData.nonce !== context.serverDHParams.nonce) {
        throw createError('Nonce mismatch %s != %s', context.serverDHParams.nonce, serverDHInnerData.nonce);
    }
    if (serverDHInnerData.server_nonce !== context.serverDHParams.server_nonce) {
        throw createError('ServerNonce mismatch %s != %s', context.serverDHParams.server_nonce, serverDHInnerData.server_nonce);
    }
    // Synch the local time with the server time
    mtproto.time.timeSynchronization(serverDHInnerData.server_time, context.reqDHDuration);
    context.serverDHInnerData = serverDHInnerData;
    return context;
}
1246332
private Object readDataField(int bytes, int datalen)
                    throws IOException,
                    ClassNotFoundException {

        Object value = null;

        deserializeTimer.reset();
        if (bytes == 0) { // yes, need to deserialize
            if ((databuf == null) || (databuf.length < datalen)) {
                databuf = new byte[datalen];
            }

            deserialize_time += deserializeTimer.elapsed(); // careful not to add physical i/o into time
            filemgr.read(databuf, 0, datalen); // read data
            deserializeTimer.reset();

            value = SerializationUtility.deserialize(Arrays.copyOf(databuf, datalen), htoddc.cacheName);
            bytes_deserialized += datalen; // we don't count application deserialzation

        } else {
            value = new byte[datalen]; // space for data
            deserialize_time += deserializeTimer.elapsed(); // avoid counting physical i/o
            filemgr.read((byte[]) value); // read data
            deserializeTimer.reset();
        }
        deserialize_time += deserializeTimer.elapsed();

        //
        // If static deserializion buffer bloats things get expensive.  Force 
        // reallocation if a huge object is read in.
        //
        if (datalen > 100000) {
            databuf = null;
        }

        return value;
    }
625378
public <T> T deser(Object obj, byte[] array, int offset, int length) throws IOException {
		Map<Class, Deserializer> deserializers = cachedDeserializers.get();
		Deserializer deSer = deserializers.get(obj.getClass());
		if(deSer == null) {
			deSer = serialization.getDeserializer(obj.getClass());
			deserializers.put(obj.getClass(), deSer);
		}
		DataInputBuffer baIs = cachedInputStream.get();
		baIs.reset(array, offset, length);
		deSer.open(baIs);
		obj = deSer.deserialize(obj);
		deSer.close();
		baIs.close();
		return (T) obj;
	}
261042
def _from_json_list(cls, response_raw, wrapper=None):
        

        json = response_raw.body_bytes.decode()
        obj = converter.json_to_class(dict, json)
        array = obj[cls._FIELD_RESPONSE]
        array_deserialized = []

        for item in array:
            item_unwrapped = item if wrapper is None else item[wrapper]
            item_deserialized = converter.deserialize(cls, item_unwrapped)
            array_deserialized.append(item_deserialized)

        pagination = converter.deserialize(client.Pagination,
                                           obj[cls._FIELD_PAGINATION])

        return client.BunqResponse(array_deserialized, response_raw.headers,
                                   pagination)
293746
def objectcount(data, key):
    """"""
    objkey = key.upper()
    return len(data.dt[objkey])
955964
def deserialize(to_deserialize, *args, **kwargs):
    
    if isinstance(to_deserialize, string_types):
        if re.match('^[0-9a-f]{24}$', to_deserialize):
            return ObjectId(to_deserialize)
        try:
            return bson_loads(to_deserialize, *args, **kwargs)
        except:
            return bson_loads(bson_dumps(to_deserialize), *args, **kwargs)
    else:
        return bson_loads(bson_dumps(to_deserialize), *args, **kwargs)
773471
def loads(s, single=False, version=_default_version,
          strict=False, errors='warn'):
    
    ms = deserialize(s, version=version, strict=strict, errors=errors)
    if single:
        return next(ms)
    else:
        return ms
1216495
private void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException {
    int size, expectedMaxSize;
    Object o;

    expectedMaxSize = s.readInt();
    size = s.readInt();

    map = new IdentityHashMap<E, Boolean>(expectedMaxSize);
    for (int i = 0; i < size; i++) {
      o = s.readObject();
      internalAdd(ErasureUtils.<E>uncheckedCast(o));
    }
  }
1232515
def _is_deserialized(cls, cls_target, obj):
        

        if cls_target is None:
            return True

        if cls_target in {list, dict}:
            return True

        if cls._is_bytes_type(cls_target):
            return True

        if obj is None:
            return True

        if type(obj) in {list, cls_target}:
            return True

        return False
47288
def _deserialize(x, elementType, compress, relicReadBinFunc):
    
    # Convert the bytearray into an appropriately sized ctypes array of bytes
    b = (c_ubyte*len(x))(*bytearray(x))

    # The compression flag is an integer.
    flag = c_int(compress)

    # Deserialize using the read function.
    result = elementType()
    relicReadBinFunc(byref(result), byref(b), len(x), flag)
    return result
294922
def deserialize(obj):
    """"""
    # Be careful of shallow copy here
    target = dict(obj)
    class_name = None
    if '__class__' in target:
        class_name = target.pop('__class__')
    if '__module__' in obj:
        obj.pop('__module__')
    # Use getattr(module, class_name) for custom types if needed
    if class_name == 'datetime':
        return datetime.datetime(tzinfo=utc, **target)
    if class_name == 'StreamingBody':
        return StringIO(target['body'])
    # Return unrecognized structures as-is
    return obj
1061302
private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException {
        // Read in any hidden serialization magic
        s.defaultReadObject();

        // Read in HashMap capacity and load factor and create backing HashMap
        int capacity = s.readInt();
        float loadFactor = s.readFloat();
        map = (((HashSet)this) instanceof LinkedHashSet ?
               new LinkedHashMap<E,Object>(capacity, loadFactor) :
               new HashMap<E,Object>(capacity, loadFactor));

        // Read in size
        int size = s.readInt();

        // Read in all elements in the proper order.
        for (int i=0; i<size; i++) {
            E e = (E) s.readObject();
            map.put(e, PRESENT);
        }
    }
907660
def deserialize(self, raw_data, **kwargs):
        """"""
        super(DateTimeField, self).deserialize(raw_data, **kwargs)
        return self.converted