Data processing method, device and equipment
By receiving code compression requests, identifying and processing sub-code and image data, the problem of low debugging efficiency caused by inaccurate code compression in existing technologies is solved, achieving more efficient code compression and higher execution success rate.
Patent Information
- Application Number
- CN202511582150.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-02-17
AI Technical Summary
Existing code compression methods cannot detect classes in incomplete string form, leading to inefficiency during code debugging. It is necessary to improve the accuracy of code compression to improve development efficiency.
By receiving code compression requests, identifying sub-codes that appear more than a threshold number of times, extracting and inserting relevant call statements, judging compilation efficiency, and if the requirements are not met, compressing the image data to generate target code.
It improves the accuracy and efficiency of code compression, avoids the problem of low debugging success rate caused by deleting unused classes, and further compresses image data when necessary, ensuring the success rate of code execution.
Smart Images

Figure CN121541883A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a data processing method, apparatus, and device. Background Technology
[0002] In software application development, code compression is often performed to reduce file size and improve execution efficiency. For example, unused or uninstantiated classes can be removed during code compression.
[0003] However, during code debugging, incomplete string references to classes may occur. This means that the compression method cannot detect classes referenced in incomplete string form, requiring repeated debugging and resulting in low code development efficiency. Therefore, a technical solution is needed to improve the accuracy of code compression and thus improve code development efficiency. Summary of the Invention
[0004] The purpose of this invention is to provide a technical solution that can improve the accuracy of code compression and thus improve code development efficiency.
[0005] To solve the above-mentioned technical problems, the embodiments of the present invention are implemented as follows: In a first aspect, an embodiment of the present invention provides a data processing method, the method comprising: Receive a code compression request for the code to be executed; In response to the code compression request, identify multiple sub-codes in the code to be executed that appear more than a preset threshold number of times; Extract the multiple sub-codes from the code to be executed, and insert calling statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; Determine whether the compressed executable code meets the preset compilation efficiency requirements; If it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the image data in the compressed executable code is compressed to obtain the target code, and the target code is executed.
[0006] In a second aspect, embodiments of the present invention provide a data processing apparatus, the apparatus comprising: The request receiving module is used to receive code compression requests for the code to be executed. The code determination module is used to determine, in response to the code compression request, multiple sub-codes in the code to be executed that appear more than a preset number of times; The code compression module is used to extract the multiple sub-codes from the code to be executed, and insert call statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; The requirement judgment module is used to determine whether the compressed executable code meets the preset compilation efficiency requirements. The code execution module is used to compress the image data in the compressed executable code to obtain target code and execute the target code when it is determined that the compressed executable code does not meet the preset compilation efficiency requirements.
[0007] Thirdly, embodiments of the present invention provide a data processing device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the data processing method provided in the above embodiments.
[0008] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the data processing method provided in the above embodiments.
[0009] Fifthly, embodiments of the present invention provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the data processing method provided in the above embodiments. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart illustrating a data processing method according to the present invention; Figure 2 This is a flowchart illustrating the compression process of executable code according to the present invention; Figure 3 This is a schematic diagram illustrating another compression process of executable code according to the present invention; Figure 4 This is a flowchart illustrating another compression process for executable code according to the present invention; Figure 5 This is a flowchart illustrating the image data compression process of the present invention; Figure 6 This is a flowchart illustrating the image data loading process according to the present invention. Figure 7 This is a schematic diagram of an image enhancement process according to the present invention; Figure 8 This is a schematic diagram illustrating the optimization process of a SourceMap according to the present invention; Figure 9 This is a schematic diagram of the structure of a data processing device according to the present invention; Figure 10 This is a schematic diagram of the structure of a data processing device according to the present invention. Detailed Implementation
[0012] This invention provides a data processing method, apparatus, and device.
[0013] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0014] This specification provides data processing methods, apparatus, and devices. In software application development, code compression is often performed to reduce code file size and improve execution efficiency. For example, unused or uninstantiated classes can be removed during code compression. However, during code debugging, incomplete string references to classes may occur, meaning the compression method cannot detect such incomplete string references, requiring repeated debugging and resulting in low code development efficiency. Therefore, a technical solution is needed to improve code compression accuracy and thus enhance code development efficiency. In this solution, a code compression request for the code to be executed is received. In response to the request, multiple sub-codes appearing more than a preset threshold in the code to be executed are identified. These sub-codes are extracted, and related call statements are inserted into the code to obtain compressed code. The compressed code is then judged to meet preset compilation efficiency requirements. If the compressed code does not meet these requirements, the image data in the compressed code is compressed to obtain target code, which is then executed. In this way, on the one hand, redundant and frequently occurring code, such as common code, can be extracted from the code to be executed and processed. The extracted code (i.e., sub-code) can then be replaced within the executable code through call statements. This avoids the low debugging success rate caused by deleting unused classes, improving code compression efficiency while ensuring code execution success rate. On the other hand, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirements, image data can be compressed to further improve code compression efficiency. Specific processing details can be found in the following embodiments.
[0015] like Figure 1 As shown, this embodiment of the invention provides a data processing method. The execution subject of this method can be a terminal device or a server. The terminal device can be a mobile terminal device such as a mobile phone, tablet computer, or smartwatch, or a terminal device such as a computer. The server can be an independent server or a server cluster composed of multiple servers. Specifically, the method may include the following steps: In step S102, a code compression request for the code to be executed is received.
[0016] The code to be executed can be any executable code, such as code used to render a page or code used to perform a preset operation.
[0017] In practice, the server can filter candidate code based on factors such as line count threshold, data packet size, and initial compilation time, and then determine the selected candidate code as the code to be executed, triggering a code compression request for that code.
[0018] For example, users can leverage the Vue framework in conjunction with an AI engine to trigger the generation of front-end applications. Vue is a progressive JavaScript framework that can be used to build user interfaces and single-page applications (SPAs). It is lightweight, flexible, and easy to learn, and can be used to build front-end applications ranging from small to large.
[0019] The AI engine is an engine platform based on large language models. It includes related AI tools and intelligent agents. The AI engine can provide various algorithms, models, and functional modules needed to build intelligent systems, enabling developers to more easily create applications with learning, reasoning, and perception capabilities. For example, the AI engine can provide the following specific functions: 1. Machine Learning and Deep Learning Support: The AI engine can provide a range of machine learning algorithms (such as decision trees, support vector machines, Naive Bayes, etc.) and deep learning frameworks (such as TensorFlow, PyTorch, etc.) to support data training and prediction.
[0020] 2. Natural Language Processing (NLP): Includes functions such as text analysis, sentiment analysis, and machine translation, which help understand and generate human language.
[0021] 3. Computer vision: Through functions such as image recognition, object detection, and video analysis, machines are able to "see" and understand the world around them.
[0022] 4. Speech recognition and synthesis: converting human voice into text (speech recognition), or converting text into speech (speech synthesis).
[0023] 5. Automated Machine Learning (AutoML): Simplifies the selection, training, and optimization of machine learning models, lowering the barrier to entry.
[0024] 6. Real-time analysis and prediction: Based on historical data, perform pattern recognition and make predictions about future events.
[0025] When the server detects that a user has given instructions to generate a front-end application using the Vue framework and an AI engine, it can obtain the program code corresponding to the generated front-end application and identify the program code as candidate code (or code to be executed).
[0026] Furthermore, the method for determining the code to be executed described above is an optional and implementable method. In practical application scenarios, there can be a variety of different methods. Different methods can be selected according to different practical application scenarios. This specification does not specifically limit this method in the embodiments.
[0027] In step S104, in response to the code compression request, multiple sub-codes in the code to be executed that appear more than a preset threshold number of times are identified.
[0028] In implementation, the server can use a pre-trained code segmentation model to segment the code to be executed into multiple code blocks. The code segmentation model can be a model built based on a preset deep learning algorithm.
[0029] The server can obtain the number of times each code block appears in the code to be executed, and identify code blocks whose number of occurrences exceeds a preset threshold as sub-code.
[0030] Furthermore, the method for determining the above-mentioned sub-code is an optional and implementable method. In actual application scenarios, there can be a variety of different methods for determining the sub-code. Different methods can be selected according to different actual application scenarios. This specification does not specifically limit the implementation of this method.
[0031] In step S106, multiple sub-codes are extracted from the code to be executed, and call statements related to the sub-codes are inserted into the code to be executed to obtain compressed code to be executed.
[0032] In practice, the server can store sub-code in a preset storage space. Then, the server can extract multiple sub-codes from the code to be executed and insert the call statements from the preset storage space into the code to be executed to obtain the compressed code to be executed.
[0033] Alternatively, the server can generate functional plugins corresponding to the sub-code and insert the function plugin call statements into the code to be executed to obtain compressed code to be executed.
[0034] Furthermore, the insertion method of the above-mentioned sub-code call statement is an optional and implementable insertion method. In actual application scenarios, there can be a variety of different insertion methods. Different insertion methods can be selected according to different actual application scenarios. This specification does not specifically limit this embodiment.
[0035] In step S108, it is determined whether the compressed executable code meets the preset compilation efficiency requirements.
[0036] In practice, the server can compile the compressed executable code and obtain the compilation time of the compressed executable code.
[0037] The server can determine whether the compressed executable code meets the preset compilation efficiency requirements based on the compilation time and the preset compilation time threshold. For example, if the compilation time is greater than the preset compilation time threshold, it can be determined that the compressed executable code does not meet the preset compilation efficiency requirements, and vice versa.
[0038] The preset compilation time threshold can be determined based on the business type and compilation priority of the business to which the code to be compressed belongs.
[0039] In step S110, if it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the image data in the compressed executable code is compressed to obtain the target code, and the target code is executed.
[0040] In practice, if it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the server can use a pre-trained image compression model to compress the image data in the compressed executable code to obtain the target code. The image compression model can be a model built based on a preset deep learning algorithm.
[0041] Alternatively, the server can crop the image data in the compressed code to be executed based on a preset cropping size to obtain the target code.
[0042] The image data compression method described above is an optional and implementable compression method. In practical application scenarios, there are many other compression methods that can be selected according to different application scenarios. This specification does not specifically limit the embodiments in this way.
[0043] This invention provides a data processing method. It receives a code compression request for executable code, and in response, identifies multiple sub-codes in the executable code that appear more than a preset threshold number of times. These sub-codes are extracted from the executable code, and call statements related to the sub-codes are inserted into the executable code to obtain compressed executable code. The method then determines whether the compressed executable code meets a preset compilation efficiency requirement. If the compressed executable code does not meet the preset compilation efficiency requirement, the image data in the compressed executable code is compressed to obtain target code, which is then executed. This approach, on the one hand, allows for the extraction and processing of frequently occurring redundant or common code from the executable code, and the replacement of the extracted code (i.e., sub-codes) within the executable code through call statements. This avoids the low debugging success rate caused by deleting unused classes, improving code compression efficiency while ensuring code execution success rate. On the other hand, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirement, image data can be compressed to further improve code compression efficiency.
[0044] In practical applications, the specific processing methods for inserting call statements related to sub-codes into the code to be executed in step S106 above to obtain the compressed code to be executed can be varied. Sub-codes may include auxiliary functions. Accordingly, the following provides one optional processing method, such as... Figure 2 As shown, the process may specifically include the following steps, S1062.
[0045] In step S1062, a functional plugin corresponding to the auxiliary function is generated, and the calling statement of the functional plugin is inserted into the code to be executed to obtain the compressed code to be executed.
[0046] In practice, taking the code to be executed as ES6 code under the Vue framework as an example, when Webpack uses Babel to convert ES6 code into ES5 code in the Vue architecture, it injects some helper functions. For example, Babel will embed these dependent helper function codes in each output file. Therefore, if multiple source code files depend on these helper functions, the problem of duplicate helper functions will occur.
[0047] Helper functions can be used to implement ES6 features such as class inheritance, template strings, and the spread operator. If left unchecked, these helper functions will appear repeatedly in every file that needs them, leading to an increase in the size of the compiled code.
[0048] To avoid duplicate code related to helper functions, Babel can be optimized by importing them using `require('babel-runtime / helpers / createClass')` (i.e., the call statement) when depending on them, ensuring they only appear once.
[0049] This can be achieved using the babel-plugin-transform-runtime plugin, which replaces the sub-code corresponding to the helper function in the code to be executed with the aforementioned import statement, thereby reducing the file size of the code compiled by Babel.
[0050] By using the babel-plugin-transform-runtime plugin (i.e., the plugin corresponding to helper functions), the size of the compiled Babel code can be effectively reduced, especially when Babel helper functions (such as createClass, extends, etc.) are used multiple times in a project. This plugin avoids code duplication by removing helper functions from the global scope and replacing them with versions imported from the babel-runtime package. The optimization method is as follows: 1) Install babel-plugin-transform-runtime and babel-runtime.
[0051] 2) Add the babel-plugin-transform-runtime plugin to the Babel configuration file (such as .babelrc or babel.config.js).
[0052] In this way, when Babel compiles the code, the babel-plugin-transform-runtime plugin will find all Babel helper functions and replace them with equivalents imported from babel-runtime or @babel / runtime. This ensures that even if the same helper function is used multiple times in the code, it will only be imported once in the compiled code.
[0053] In practical applications, the specific processing methods for inserting call statements related to the sub-code into the executable code in step S106 above to obtain the compressed executable code can be varied. The sub-code may include code corresponding to the target module, and the target module may be a module that has module dependencies on multiple pages. Accordingly, the following provides an optional processing method, such as... Figure 3 As shown, the specific process may include the following steps, S1064.
[0054] In step S1064, the code related to the target module is stored in a preset storage space, and the call statement of the preset storage space is inserted into the code to be executed to obtain the compressed code to be executed.
[0055] In implementation, the server can extract common code from multiple pages into separate files, using plugins like CommonsChunkPlugin or SplitChunksPlugin (i.e., calls to pre-defined storage spaces) to extract shared dependencies (such as third-party libraries and common modules) from multiple entry files into separate chunks (pre-defined storage spaces). This avoids repeatedly loading the same code across multiple pages or components, reduces redundant resource loading, improves loading speed, and saves bandwidth.
[0056] Furthermore, by packaging common code separately, when a part of the application is updated, only that part of the code needs to be downloaded again, while the common code remains unchanged. This reduces the amount of downloads and improves loading speed. At the same time, the common code can be cached for a long time, only needing to be downloaded again when it is updated, while other parts of the application can be updated independently without affecting the cached common code.
[0057] During project execution, the vendors cache group matches modules in node_modules and extracts them into a separate chunk named vendors.bundle.js. The default cache group can be used to extract common modules shared by at least two entry files. To ensure the effectiveness of extracting common code, Webpack can also take the following measures: 1. Cache Group Priority: In cacheGroups, you can set the priority of different cache groups using the priority attribute. The larger the number, the higher the priority.
[0058] 2. Filename: The filename attribute can be used to specify the name of the output file for a specific cache group.
[0059] 3. Asynchronous and Synchronous Chunks: `chunks: 'all'` indicates that this configuration will apply to both asynchronous and synchronous chunks. To split asynchronous chunks, set it to 'async'.
[0060] 4. Performance optimization: In production environments, compression plugins (such as TerserPlugin) and code splitting techniques can be used to further optimize Webpack builds.
[0061] 5. Verify the test results: Run Webpack and check the dist directory. You should see the extracted vendors.bundle.js and other possible common code chunks. Check the extraction effect.
[0062] In summary, failing to extract third-party libraries and common modules from each page results in the repeated loading of identical resources, wasting user bandwidth and server costs. Furthermore, the excessive resources required for each page lead to slow initial page load times, negatively impacting user experience. Therefore, optimizing by extracting common code can reduce redundant loading, improve component loading speed, save bandwidth, optimize cache utilization, and enhance overall application performance and user experience.
[0063] In practical applications, the specific processing methods for inserting call statements related to the sub-code into the executable code in step S106 above to obtain the compressed executable code can vary. The sub-code may include the code corresponding to controls on the page. Accordingly, the following provides an optional processing method, such as... Figure 4 As shown, the specific process may include the following steps, S1066.
[0064] In step S1066, the code corresponding to the control is stored in the preset data processing unit corresponding to the page to which the control belongs, and the call statement of the data processing unit corresponding to the page is inserted into the code to be executed and the code corresponding to the page to which the control belongs, to obtain the compressed code to be executed.
[0065] In practice, taking HTML code as an example, in list pages with HTML code, the HTML structure is identical except for the number of columns and the specific content. However, when creating new pages, these repetitive table, tr, and td elements inevitably need to be added to the page. Furthermore, the same problem exists with the HTML structure of search forms across different list pages. Even different pages for adding and editing data, as well as pages for displaying data, will exhibit varying degrees of HTML duplication.
[0066] The server can generate JavaScript widgets to make up the page, each widget can be used to represent a single small function, and at the same time develop a backend data processing unit (class or method), with one data processing unit corresponding to each page.
[0067] Then, an XML configuration file representing the page can be written to organize various controls. The front-end can then read and parse this XML configuration file to extract all the control names. This allows it to load the control script files, instantiate them, and call methods to obtain the control's HTML (i.e., the call statements for the data processing unit). Finally, the HTML can be concatenated to generate the page.
[0068] When data is submitted, the front end can collect the control results and send them to the server, which can then call the code corresponding to the control in the data processing unit.
[0069] In practical applications, the specific processing method for compressing the image data in the compressed executable code in step S108 above to obtain the target code can be varied. The following provides one optional processing method, such as... Figure 5 As shown, the specific process may include the following steps, S1082.
[0070] In step S1082, a target image with a size larger than a preset size threshold is obtained from the image data, and the target image is compressed to obtain the target code.
[0071] In implementation, within the Vue framework, image data can be processed by setting a limit in the url-loader of webpack.base.conf.js. For example, image data smaller than the limit can be converted to base64 format, while other data remains unchanged. To address the issue of slow loading of larger image data when requesting resources, image data can be compressed to improve loading speed.
[0072] For example, in Webpack configuration, you can add the image-webpack-loader to compress target images whose size exceeds a preset size threshold. This loader supports various formats (such as PNG, JPEG, GIF, and SVG) and can effectively reduce image file size.
[0073] In practical applications, there can be various ways to execute the target code in step S108 above. The following provides one optional method, such as... Figure 6 As shown, the specific process may include the following steps, S1084.
[0074] In step S1084, when the compressed target image enters the visible area, the compressed target image is loaded.
[0075] In implementation, such as Figure 7As shown, after adding a loader to compress the target image, lazy loading and on-demand loading of images can also be implemented. For example, in Webpack, the third-party library vue-lazyload and the native IntersectionObserver API can be referenced. Combined with Webpack's code splitting function, lazy loading of image resources can be implemented. That is, the corresponding image resources are only loaded when the compressed target image is about to enter the visible area. At the same time, during the image loading process, placeholders (such as blurred images, loading animations, etc.) can also be used to improve the user experience and avoid the page from being blank or in a loading state.
[0076] like Figure 7 As shown, caching and CDN service integration can also be optimized. Reasonable caching strategies can be set, and reasonable caching time can be set for image resources to reduce duplicate requests. For example, HTTP caching headers (such as Cache-Control, Expires, etc.) can be used to control caching behavior. At the same time, CDN services can be integrated to accelerate image access. Image resources can be deployed on CDN (Content Delivery Network) and the access speed of images can be accelerated through distributed caching nodes, thereby improving the user experience.
[0077] By enhancing and optimizing Webpack's image processing in the ways described above, the size of image resources can be effectively reduced, and image loading speed can be improved, thereby enhancing the user experience.
[0078] Furthermore, when developing using the traditional Vue architecture, the build process may involve merging, compressing, and transcribing source code, which generates difficult-to-read source maps, posing challenges for debugging and locating problems. To improve development efficiency and debugging experience, such as... Figure 8 As shown, the sourceMap can also be optimized using the following methods to solve the problem of difficult-to-debug code during development: 1) Separation of production and development environments: In the development environment, code compression and obfuscation are disabled, while the complete source map is retained so that developers can directly view the original source code in the browser's developer tools. In the production environment, code compression and obfuscation are enabled, and a lighter-weight source map is generated for debugging in the production environment when needed.
[0079] 2) Use advanced source map options: Webpack supports various source map types, such as source-map, inline-source-map, and eval-source-map. Different types differ in performance, generated file size, and debugging convenience. In development environments, eval-source-map can be chosen, which provides good performance without affecting the debugging experience. In production environments, source-map (but needs to be deployed with the source code, occupying some space) or nosources-source-map (does not include source code, only maps filenames and line numbers, suitable for scenarios where only line number location is needed) can be chosen.
[0080] 3) Environment Variable Control: Environment variables (such as .env files) control whether source maps are generated and the type of source maps. This allows for easy configuration switching across different deployment environments (development, testing, production).
[0081] 4) Build process optimization: Code splitting and lazy loading can be used during the build process to reduce the size of individual files and improve loading speed. Tree Shaking is used to remove unreferenced code, further reducing the size of the packaged file.
[0082] 5) Mapping source code to specific modules or components: Write custom Webpack plugins to handle source maps. For example, write a plugin to add extra information (such as version number, build time, etc.) when generating source maps, or modify the format of source maps to better suit the debugging needs of the project. Simultaneously, mapping the minified code to specific Vue components or modules helps developers locate the source of problems more quickly.
[0083] By using the optimization methods described above, Webpack can improve debugging efficiency and problem localization capabilities during the development process while maintaining code performance and security.
[0084] This approach, employing Vue-enhanced component technology for AI data storage, addresses current Vue issues such as low Webpack efficiency and insufficient support from Vue-Property-Decorator components. It enhances Webpack image processing, reduces redundant ES6-to-ES5 conversion code, extracts common code, optimizes SourceMaps, and builds an architecture for result output analysis. Simultaneously, it enhances Vue-Property-Decorator's tool capabilities, improving support for Vue.js components. Building upon this foundation, the AI engine can achieve a one-stop solution for AI, portal assembly, and portal display, particularly supporting atomic-level component customization. This ensures that this AI engine offers more flexible support, higher performance, and a better user experience compared to traditional AI functionalities.
[0085] This specification provides a data processing method that receives a code compression request for executable code, identifies multiple sub-codes in the executable code that appear more than a preset threshold number of times in response to the request, extracts these sub-codes, inserts call statements related to the sub-codes into the executable code, obtains compressed executable code, determines whether the compressed executable code meets preset compilation efficiency requirements, and if it does not, compresses the image data in the compressed executable code to obtain target code, which is then executed. This method, on the one hand, allows for the extraction and processing of frequently occurring redundant or common code from the executable code, and the replacement of the extracted code (i.e., sub-codes) within the executable code through call statements, avoiding the low debugging success rate caused by deleting unused classes. This improves code compression efficiency while ensuring code execution success rate. On the other hand, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirements, image data can be compressed to further improve code compression efficiency.
[0086] The above describes the data processing method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a data processing device, such as... Figure 9 As shown.
[0087] The data processing device includes: a request receiving module 901, a code determination module 902, a code compression module 903, a demand judgment module 904, and a code execution module 905, wherein: The request receiving module 901 is used to receive code compression requests for the code to be executed. The code determination module 902 is used to determine, in response to the code compression request, multiple sub-codes in the code to be executed that appear more than a preset number of times; The code compression module 903 is used to extract the plurality of sub-codes from the code to be executed, and insert call statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; The requirement judgment module 904 is used to determine whether the compressed executable code meets the preset compilation efficiency requirements; The code execution module 905 is used to compress the image data in the compressed executable code to obtain target code and execute the target code when it is determined that the compressed executable code does not meet the preset compilation efficiency requirements.
[0088] In the embodiments described in this specification, the sub-code includes auxiliary functions, and the code compression module 903 is used for: Generate a functional plugin corresponding to the auxiliary function, and insert the calling statement of the functional plugin into the code to be executed to obtain the compressed code to be executed.
[0089] In this embodiment of the specification, the sub-code includes code corresponding to the target module, where the target module is a module that has module dependencies with multiple pages. The code compression module 903 is used for: The code related to the target module is stored in a preset storage space, and the call statement of the preset storage space is inserted into the code to be executed to obtain the compressed code to be executed.
[0090] In this embodiment of the specification, the sub-code includes the code corresponding to the controls on the page; the step of inserting a call statement related to the sub-code into the code to be executed; and the code compression module 903, used for: The code corresponding to the control is stored in the preset data processing unit corresponding to the page to which the control belongs. Then, the call statement of the data processing unit corresponding to the page to which the control belongs is inserted into the code to be executed and the code corresponding to the page to which the control belongs, so as to obtain the compressed code to be executed.
[0091] In this embodiment of the specification, the code execution module 905 is used for: Obtain the target image from the image data whose image size is greater than a preset size threshold, and compress the target image to obtain the target code.
[0092] In this embodiment of the specification, the code execution module 905 is used for: When the compressed target image enters the visible area, the compressed target image is loaded.
[0093] This specification provides a data processing apparatus that receives a code compression request for executable code, and in response to the request, identifies multiple sub-codes in the executable code that appear more than a preset threshold number of times. Multiple sub-codes are extracted from the executable code, and call statements related to these sub-codes are inserted into the executable code to obtain compressed executable code. The apparatus then determines whether the compressed executable code meets a preset compilation efficiency requirement. If the compressed executable code does not meet the preset compilation efficiency requirement, the image data in the compressed executable code is compressed to obtain target code, which is then executed. This approach allows for the extraction and processing of frequently occurring redundant or common code from the executable code, and the replacement of the extracted code (i.e., sub-codes) within the executable code through call statements. This avoids the low debugging success rate caused by deleting unused classes, improving code compression efficiency while ensuring code execution success rate. Furthermore, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirement, image data can be compressed to further improve code compression efficiency.
[0094] The above are the data processing apparatuses provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a data processing device, such as... Figure 10 As shown.
[0095] The data processing device can provide terminal equipment or servers, etc., for the above embodiments.
[0096] Data processing devices can vary considerably due to differences in configuration or performance. They may include one or more processors 1001 and memory 1002, with memory 1002 storing one or more application programs or data. Memory 1002 can be temporary or persistent storage. The application programs stored in memory 1002 may include one or more modules (not shown), each module including a series of computer-executable instructions for the data processing device. Furthermore, processor 1001 may be configured to communicate with memory 1002 and execute the series of computer-executable instructions stored in memory 1002 on the data processing device. The data processing device may also include one or more power supplies 1003, one or more wired or wireless network interfaces 1004, one or more input / output interfaces 1005, and one or more keyboards 1006.
[0097] Specifically, in this embodiment, the data processing device includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the data processing device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following: Receive a code compression request for the code to be executed; In response to the code compression request, identify multiple sub-codes in the code to be executed that appear more than a preset threshold number of times; Extract the multiple sub-codes from the code to be executed, and insert calling statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; Determine whether the compressed executable code meets the preset compilation efficiency requirements; If it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the image data in the compressed executable code is compressed to obtain the target code, and the target code is executed.
[0098] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the data processing device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0099] This specification provides a data processing device that receives a code compression request for executable code, identifies multiple sub-codes in the executable code that appear more than a preset threshold number of times in response to the code compression request, extracts these sub-codes, inserts call statements related to the sub-codes into the executable code, obtains compressed executable code, determines whether the compressed executable code meets preset compilation efficiency requirements, and if it does not, compresses the image data in the compressed executable code to obtain target code, and then executes the target code. In this way, on the one hand, redundant code, common code, and other frequently occurring code can be extracted from the executable code and replaced in the executable code through call statements, avoiding the problem of low code debugging success rate caused by deleting unused classes. This improves code compression efficiency while ensuring code execution success rate. On the other hand, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirements, image data can be compressed to further improve code compression efficiency.
[0100] Furthermore, based on the above Figures 1 to 8 The method shown in this specification, along with one or more embodiments, also provides a storage medium for storing computer-executable instruction information. In one specific embodiment, the storage medium can be a USB flash drive, optical disc, hard disk, etc. When the computer-executable instruction information stored in the storage medium is executed by a processor, it can achieve the following process: Receive a code compression request for the code to be executed; In response to the code compression request, identify multiple sub-codes in the code to be executed that appear more than a preset threshold number of times; Extract the multiple sub-codes from the code to be executed, and insert calling statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; Determine whether the compressed executable code meets the preset compilation efficiency requirements; If it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the image data in the compressed executable code is compressed to obtain the target code, and the target code is executed.
[0101] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the above-described storage medium embodiment is basically similar to the method embodiment, so the description is relatively simple; relevant parts can be referred to the description of the method embodiment.
[0102] This specification provides a storage medium that receives a code compression request for executable code. In response to the request, it identifies multiple sub-codes in the executable code that appear more than a preset threshold number of times. These sub-codes are then extracted from the executable code, and call statements related to the sub-codes are inserted into the executable code to obtain compressed executable code. The compressed executable code is then judged to see if it meets preset compilation efficiency requirements. If it does not meet these requirements, the image data in the compressed executable code is compressed to obtain target code, which is then executed. This approach allows for the extraction and processing of frequently occurring redundant or common code from the executable code. The extracted code (i.e., sub-codes) is then replaced within the executable code through call statements, avoiding the low debugging success rate caused by deleting unused classes. This improves code compression efficiency while ensuring code execution success rate. Furthermore, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirements, image data can be compressed to further improve code compression efficiency.
[0103] Furthermore, based on the above Figures 1 to 8 The method shown in this specification, along with one or more embodiments, also provides a computer program product including a computer program that, when executed by a processor, performs the following process: Receive a code compression request for the code to be executed; In response to the code compression request, identify multiple sub-codes in the code to be executed that appear more than a preset threshold number of times; Extract the multiple sub-codes from the code to be executed, and insert calling statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; Determine whether the compressed executable code meets the preset compilation efficiency requirements; If it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the image data in the compressed executable code is compressed to obtain the target code, and the target code is executed.
[0104] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the above-described embodiment of a computer program product is relatively simple in description because it is fundamentally similar to the method embodiment; relevant parts can be referred to the description of the method embodiment.
[0105] This specification provides a computer program product that receives a code compression request for executable code. In response to the request, it identifies multiple sub-codes in the executable code that appear more than a preset threshold number of times. These sub-codes are extracted from the executable code, and call statements related to the sub-codes are inserted into the executable code to obtain compressed executable code. The compressed executable code is then judged to see if it meets preset compilation efficiency requirements. If it does not meet these requirements, the image data in the compressed executable code is compressed to obtain target code, which is then executed. This approach allows for the extraction and processing of frequently occurring redundant or common code from the executable code. The extracted code (i.e., sub-codes) is then replaced within the executable code through call statements, avoiding the low debugging success rate caused by deleting unused classes. This improves code compression efficiency while ensuring code execution success rate. Furthermore, if the compressed executable code obtained after extracting sub-code still does not meet the preset compilation efficiency requirements, image data can be compressed to further improve code compression efficiency.
[0106] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0107] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0108] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0109] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0110] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0111] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] Embodiments in this specification are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable parallel device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable parallel device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable fraud device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions can also be loaded onto a computer or other programmable device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0116] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0117] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0118] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0119] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0120] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0121] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0122] The above description is merely an embodiment of this specification and is not intended to limit this document. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. A data processing method, characterized in that, The method includes: Receive a code compression request for the code to be executed; In response to the code compression request, identify multiple sub-codes in the code to be executed that appear more than a preset threshold number of times; Extract the multiple sub-codes from the code to be executed, and insert calling statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; Determine whether the compressed executable code meets the preset compilation efficiency requirements; If it is determined that the compressed executable code does not meet the preset compilation efficiency requirements, the image data in the compressed executable code is compressed to obtain the target code, and the target code is executed.
2. The method according to claim 1, characterized in that, The sub-code includes auxiliary functions. The step of inserting call statements related to the sub-code into the executable code to obtain compressed executable code includes: Generate a functional plugin corresponding to the auxiliary function, and insert the calling statement of the functional plugin into the code to be executed to obtain the compressed code to be executed.
3. The method according to claim 1, characterized in that, The sub-code includes code corresponding to the target module, which is a module that has module dependencies with multiple pages. Inserting call statements related to the sub-code into the executable code to obtain compressed executable code includes: The code related to the target module is stored in a preset storage space, and the call statement of the preset storage space is inserted into the code to be executed to obtain the compressed code to be executed.
4. The method according to claim 1, characterized in that, The sub-code includes the code corresponding to controls on the page. Inserting call statements related to the sub-code into the code to be executed to obtain compressed code to be executed includes: The code corresponding to the control is stored in the preset data processing unit corresponding to the page to which the control belongs. Then, the call statement of the data processing unit corresponding to the page to which the control belongs is inserted into the code to be executed and the code corresponding to the page to which the control belongs, so as to obtain the compressed code to be executed.
5. The method according to claim 1, characterized in that, The step of compressing the image data in the compressed executable code to obtain the target code includes: Obtain the target image from the image data whose image size is greater than a preset size threshold, and compress the target image to obtain the target code.
6. The method according to claim 4, characterized in that, The execution of the target code includes: When the compressed target image enters the visible area, the compressed target image is loaded.
7. A data processing apparatus, characterized in that, The device includes: The request receiving module is used to receive code compression requests for the code to be executed. The code determination module is used to determine, in response to the code compression request, multiple sub-codes in the code to be executed that appear more than a preset number of times; The code compression module is used to extract the multiple sub-codes from the code to be executed, and insert call statements related to the sub-codes into the code to be executed to obtain compressed code to be executed; The requirement judgment module is used to determine whether the compressed executable code meets the preset compilation efficiency requirements. The code execution module is used to compress the image data in the compressed executable code to obtain target code and execute the target code when it is determined that the compressed executable code does not meet the preset compilation efficiency requirements.
8. A data processing device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the data processing method as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the data processing method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the steps of the data processing method according to any one of claims 1 to 6.