The invention provides a processing and optimizing method and device for a dynamic language, equipment and a storage medium. The processing and optimizing method includes the steps: based on program codes in an intermediate file, obtaining an abstract syntax tree through analysis, obtaining type description information of the corresponding program codes through analysis based on the annotation information in the intermediate file, and adding the type description information to corresponding nodes on the abstract syntax tree; and traversing the abstract syntax tree so as to obtain attribute and type information owned by the object with the class structure based on the association relationship between the nodes and the type description information of the nodes, generating a hidden class, and attaching the hidden class to the class definition node corresponding to the object so as to generate an optimization code based on the abstract syntax tree with the hidden class. Therefore, by pre-generating the hidden class during compiling, the object layout information can be known in advance, so that the source file can be optimized based on the pre-generated hidden class to avoid the overhead of adding attributes to create the hidden class and expanding the object layout during running, and the running rate is increased.