Deserialization method and apparatus, and computing device
AssigneeHuawei Cloud Computing Technologies Co., Ltd.
InventorsWeihua SHAN, Xuliang LI
Life of this patent
Estimating the term…
Abstract
This application discloses a deserialization method. A first object shell of a first object is created in memory space of a process, where the first object shell includes a first object header and a first object body; a serialization result of the first object is obtained; the serialization result of the first object is deserialized based on the first object shell, to obtain the first object; and after the first object is used by the process, the first object shell is released, where the first object shell may be used to deserialize a subsequently received serialization result. Deserialization efficiency is improved by reusing an object shell.
Claims17
A method for performing deserialization by a computing device, comprising:
- creating a first object shell of a first object in memory space of a process, wherein the first object shell comprises a first object header and a first object body, the first object header comprises a type pointer of the first object, and space is reserved in the first object body for an element of the first object;
- obtaining a serialization result of the first object;
- obtaining the first object shell;
- and
- deserializing the serialization result of the first object based on the first object shell, to obtain the first object.
A computing device, comprising a processor and a memory storing instructions, wherein
- when the instructions are executed by the processor, the processor is configured to:
- create a first object shell of a first object in memory space of a process, wherein the first object shell comprises a first object header and a first object body, the first object header comprises a type pointer of the first object, and space is reserved in the first object body for an element of the first object;
- obtain a serialization result of the first object;
- obtain the first object shell;
- and
- deserialize the serialization result of the first object based on the first object shell, to obtain the first object.
A method for performing deserialization by a computing device, comprising:
- obtaining an idle object shell from an object pool, wherein the object pool is provided with at least one object shell, and each object shell is used to obtain a plurality of objects through deserialization;
- and
- deserializing a received serialization result based on the idle object shell, to obtain a target object.
A non-transitory readable storage medium storing instructions, which when executed by a computing device cause the computing device to perform the following method:
- creating a first object shell of a first object in memory space of a process, wherein the first object shell comprises a first object header and a first object body, the first object header comprises a type pointer of the first object, and space is reserved in the first object body for an element of the first object;
- obtaining a serialization result of the first object;
- obtaining the first object shell;
- deserializing the serialization result of the first object based on the first object shell, to obtain the first object.
Dependencies are inferred from the claim text.