The present disclosure provides a compiling method and device, first, obtaining a to-be-compiled code, and generating a plurality of compiling tasks corresponding to the to-be-compiled code; then, for any compiling task, determining a target
code segment corresponding to the compiling task before starting to execute the compiling task; then, searching for a cached compressed compiling product corresponding to the target
code segment, if the compressed compiling product is successfully found, determining a target decompression
algorithm matching the compressed compiling product from a plurality of to-be-selected decompression algorithms; secondly, decompressing the compressed compiling product by using the target decompression
algorithm to obtain a decompressed compiling product corresponding to the compiling task; finally, generating an
executable file corresponding to the to-be-compiled code based on the obtained decompressed compiling product. The present disclosure embodiment realizes diversified selection of compression algorithms, improves the flexibility of the selection of compression algorithms during compiling, and improves the compiling efficiency.