Mobile application cold start speed optimization method and device, equipment and storage medium
By asynchronously and concurrently executing network requests and caching data tasks during the mobile application startup phase, and asynchronously rendering and refreshing the interface, the latency problem during the cold start of the mobile application is solved, enabling the rapid display of the complete homepage and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
Mobile applications often experience white screens, blank frames, or loading animations during cold starts due to the serialized initialization process. Users have to wait for network responses, making it impossible to achieve the goal of "instant opening". Existing preloading or caching strategies fail to systematically integrate network request preloading, cache rendering, and asynchronous updates into parallel processing, which affects the user experience.
During the application startup callback method execution phase, multiple speed optimization tasks are executed asynchronously and concurrently, including initiating network requests and reading cached data, asynchronously rendering the homepage interface, and performing differential comparison and refresh after receiving the network response.
It achieves a "second-open" experience, eliminates the main delay of users waiting for network response, ensures data timeliness through silent asynchronous updates, and improves application robustness and user satisfaction.
Smart Images

Figure CN121833079A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of mobile terminal application performance optimization, in particular to a mobile application cold start speed optimization method, device, equipment and storage medium. BACKGROUND
[0002] The current mobile application usually adopts a serialized initialization process when cold starting: after the system loads the binary file, the main function and the application proxy start method are executed in turn, and various libraries and services are initialized in application: didFinishLaunchingWithOptions:, then the first view controller is loaded and its viewDidLoad method is triggered, at this time the network request for obtaining the home page data is initiated, the user must wait for the network response to return and complete the interface rendering before seeing the complete home page content, during which there is a white screen, blank framework or loading animation, resulting in a prolonged perceived start time, a fragmented experience and the inability to achieve the "second opening" goal. Although related solutions attempt to partially optimize through preloading or caching strategies, they fail to systematically front-load network requests, integrate cache rendering and asynchronous updates into a complete parallel and non-blocking process, and still cannot fundamentally eliminate the user's passive waiting for network delays, affecting user experience. SUMMARY
[0003] Therefore, it is necessary to provide a mobile application cold start speed optimization method, device, equipment and storage medium capable of optimizing the cold start speed of a mobile application and improving user experience in view of the above technical problems.
[0004] In a first aspect, a mobile application cold start speed optimization method is provided, the method comprising: in response to receiving a cold start instruction, asynchronously and concurrently executing a plurality of speed optimization tasks in the application start callback method execution stage of a mobile application, the speed optimization tasks at least including initiating a start interface network request for obtaining home page dynamic data and reading start interface cache data; in response to reading the start interface cache data, determining the validity of the start interface cache data; in response to the start interface cache data being valid, rendering and presenting a complete home page user interface based on the home page data model determined by the start interface cache data; simultaneously or after rendering and presenting the home page user interface, listening to and receiving response data of the start interface network request; differentially comparing the response data with the current displayed home page data model, and in response to the existence of data changes in the differential comparison result, refreshing the home page user interface based on the changed data.
[0005] Optionally, in response to receiving the cold start instruction, the multiple speed optimization tasks are asynchronously and concurrently executed in an application start callback method execution stage of the mobile application, and the multiple speed optimization tasks comprise: based on the first background thread, a request object is constructed to initiate a start interface network request for obtaining homepage dynamic data to a server, and a network response callback is registered, the request object comprising a device identifier and a version parameter; based on the second background thread, a local persistent storage is accessed according to a preset cache key, the start interface cache data and associated metadata are read, and the start interface cache data is deserialized to generate the homepage data model; the response data of the start interface network request and the homepage data model are stored in a thread-safe data container, and the corresponding task completion state is updated.
[0006] Optionally, the speed optimization task further comprises basic runtime environment initialization, and in response to receiving the cold start instruction, the multiple speed optimization tasks are asynchronously and concurrently executed in an application start callback method execution stage of the mobile application, and the multiple speed optimization tasks comprise: based on a preset configuration list, a runtime environment initialization task marked as basic and necessary is determined; the runtime environment initialization task is decomposed into multiple independent execution units, and is submitted to a target concurrent queue to asynchronously execute the runtime environment initialization task; in response to the multiple independent execution units being in a completed state, it is determined that the basic runtime environment initialization is completed, and a basic runtime environment readiness flag is set; in response to the basic runtime environment readiness flag being set, an environment readiness event is broadcasted to the system.
[0007] Optionally, before the start interface cache data is deserialized to generate the homepage data model, the method further comprises: based on the metadata associated with the start interface cache data, the validity of the start interface cache data is determined, the metadata comprising at least a cache timestamp and a data structure version identifier; based on the cache timestamp and the data structure version identifier, the start interface cache data is respectively subjected to timeliness verification and version compatibility verification, and based on the start interface cache data, integrity verification and key field verification are performed; in response to the timeliness verification, the version compatibility verification, the integrity verification and the key field verification all being verified successfully, it is determined that the start interface cache data is valid; in response to the start interface cache data being valid, the start interface cache data is deserialized to generate the homepage data model.
[0008] Optionally, in response to the start interface cache data being valid, rendering and presenting a complete homepage user interface based on the start interface cache data deserialization generated homepage data model includes: rendering a homepage overall framework structure according to layout configuration data of the homepage data model; initializing functional components of the homepage based on functional component attribute data of the homepage data model; loading content display data based on the homepage data model; setting basic interaction attributes based on interaction control state data of the homepage data model; in response to the homepage overall framework structure rendering being completed, the functional components of the homepage initialization being completed, the content display data loading being completed, and the basic interaction attributes setting being completed, presenting the complete homepage user interface on a display interface.
[0009] Optionally, while or after rendering and presenting the homepage user interface, listening to and receiving response data of the start interface network request, and differentiating and comparing the response data with the currently displayed homepage data model includes: establishing a listening channel while initiating the start interface network request, and capturing and forwarding the response data of the start interface network request while or after the homepage user interface is rendered and presented; in response to listening to and receiving the response data of the start interface network request, performing form conversion on the response data and the currently displayed homepage data model to respectively generate a first data set and a second data set that can be used for comparison; differentially comparing corresponding field and / or node values in the first data set and the second data set to determine changed fields and / or changed node values, and defining the changed fields and / or changed node values as the differential comparison result.
[0010] Optionally, in response to there being data changes in the differential comparison result, refreshing the homepage user interface based on the changed data includes: in response to there being data changes in the differential comparison result, analyzing the differential comparison result to determine content that needs to be refreshed; refreshing the homepage user interface based on the content that needs to be refreshed, and storing the latest data received in a database to overwrite old cache data.
[0011] In a second aspect, a mobile application cold start speed optimization device is provided, and the device includes: The first processing module is configured to, in response to receiving a cold start instruction, asynchronously and concurrently execute a plurality of speed optimization tasks in an application start callback method execution stage of a mobile application, the speed optimization tasks at least including initiating a start interface network request for obtaining homepage dynamic data and reading start interface cache data. The second processing module is configured to, in response to reading the start interface cache data, determine validity of the start interface cache data. The third processing module is configured to, in response to the start interface cache data being valid, render and present a complete homepage user interface based on a homepage data model determined based on the start interface cache data. The fourth processing module is configured to, simultaneously or after rendering and presenting the homepage user interface, listen to and receive response data of the start interface network request. The fifth processing module is configured to compare the response data with the homepage data model currently displayed, and in response to there being data changes in a comparison result, refresh the homepage user interface based on the changed data.
[0012] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program: The first processing module is configured to, in response to receiving a cold start instruction, asynchronously and concurrently execute a plurality of speed optimization tasks in an application start callback method execution stage of a mobile application, the speed optimization tasks at least including initiating a start interface network request for obtaining homepage dynamic data and reading start interface cache data. The second processing module is configured to, in response to reading the start interface cache data, determine validity of the start interface cache data. The third processing module is configured to, in response to the start interface cache data being valid, render and present a complete homepage user interface based on a homepage data model determined based on the start interface cache data. The fourth processing module is configured to, simultaneously or after rendering and presenting the homepage user interface, listen to and receive response data of the start interface network request. The fifth processing module is configured to compare the response data with the homepage data model currently displayed, and in response to there being data changes in a comparison result, refresh the homepage user interface based on the changed data.
[0013] In a fourth aspect, a computer readable storage medium is provided, having a computer program stored thereon, and the computer program is executable by a processor to implement the following steps: in response to receiving the cold start instruction, asynchronously and concurrently executing a plurality of speed optimization tasks at an application start callback method execution stage of the mobile application, the speed optimization tasks comprising at least initiating a start interface network request for obtaining home page dynamic data and reading start interface cache data; in response to reading the start interface cache data, determining validity of the start interface cache data; in response to the start interface cache data being valid, rendering and presenting a complete home page user interface based on a home page data model determined based on the start interface cache data; simultaneously or after rendering and presenting the home page user interface, listening to and receiving response data of the start interface network request; differentially comparing the response data with the home page data model currently displayed, and in response to there being data changes in a differential comparison result, refreshing the home page user interface based on the changed data.
[0014] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program which, when executed by a processor, implements the following steps: in response to receiving the cold start instruction, asynchronously and concurrently executing a plurality of speed optimization tasks at an application start callback method execution stage of the mobile application, the speed optimization tasks comprising at least initiating a start interface network request for obtaining home page dynamic data and reading start interface cache data; in response to reading the start interface cache data, determining validity of the start interface cache data; in response to the start interface cache data being valid, rendering and presenting a complete home page user interface based on a home page data model determined based on the start interface cache data; simultaneously or after rendering and presenting the home page user interface, listening to and receiving response data of the start interface network request; differentially comparing the response data with the home page data model currently displayed, and in response to there being data changes in a differential comparison result, refreshing the home page user interface based on the changed data.
[0015] The mobile application cold start speed optimization method, device, equipment and storage medium, the method comprises: in response to receiving a cold start instruction, asynchronously and concurrently executing a plurality of speed optimization tasks in the application start callback method execution stage of the mobile application, the speed optimization tasks at least including initiating a start interface network request for obtaining home page dynamic data and reading start interface cache data; in response to reading the start interface cache data, determining the validity of the start interface cache data; in response to the start interface cache data being valid, rendering and presenting a complete home page user interface based on the home page data model determined by the start interface cache data; while or after rendering and presenting the home page user interface, listening to and receiving response data of the start interface network request; differentiating and comparing the response data with the current displayed home page data model, and in response to the existence of data changes in the differentiation comparison result, refreshing the home page user interface based on the changed data; the application executes network request and running environment initialization in parallel, preloads data in the early stage of application start, simultaneously uses cache data for instant home page rendering, realizes "second opening" experience, eliminates the main delay of user waiting for network response, and ensures the timeliness of data through silent asynchronous updating, balances the start speed and information timeliness, guarantees stable and usable home page in network exception through built-in cache validity verification and fault tolerance mechanism, and improves application robustness and user satisfaction. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 The application environment diagram of the mobile application cold start speed optimization method in an embodiment; Figure 2 The flowchart of the mobile application cold start speed optimization method in an embodiment; Figure 3 The structural block diagram of the mobile application cold start speed optimization device in an embodiment; Figure 4 The internal structure diagram of the computer equipment in an embodiment. DETAILED DESCRIPTION
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] It should be understood that, in the description of this application, unless the context explicitly requires it, words such as "including" or "comprising" throughout the specification should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".
[0020] It should also be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0021] It should be noted that the terms "S1," "S2," etc., are used only for descriptive purposes and do not specifically refer to the order or sequence, nor are they intended to limit this application. They are merely for the convenience of describing the method of this application and should not be construed as indicating the sequential order of the steps. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0022] The mobile application cold start speed optimization method provided in this application can be applied to applications such as... Figure 1 In the application environment shown, terminal 102 communicates with a data processing platform set on server 104 via a network. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 104 can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0023] In one embodiment, such as Figure 2 As shown, a method for optimizing the cold start speed of mobile applications is provided, which is then applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps: S1: In response to receiving a cold start instruction, during the execution phase of the application startup callback method of the mobile application, multiple speed optimization tasks are executed asynchronously and concurrently. The speed optimization tasks include at least initiating a network request to the startup interface to obtain dynamic data of the homepage and reading cached data of the startup interface.
[0024] It's important to note that a cold start instruction refers to the initialization instruction issued by the operating system to the application process when the user clicks the application icon or the system triggers the startup. At this time, the application binary file is loaded from storage into memory, the process is created, and the main function begins execution. A mobile application refers to a software application running on mobile terminal operating systems (such as iOS and Android) such as smartphones and tablets, typically featuring a graphical user interface and network interaction capabilities. The application startup callback method execution phase refers to specific lifecycle methods called by the mobile operating system in the early stages of application startup, such as iOS's `application:didFinishLaunchingWithOptions:`, where developers can perform initialization tasks. Speed optimization tasks refer to a set of background tasks designed to reduce user-perceived startup time, mainly including parallel subtasks such as network pre-requests, cache reading, and environment initialization. Startup interface network requests refer to specific API calls initiated by the application server to retrieve dynamic content from the homepage, typically executed asynchronously during the startup phase to reduce data waiting time. Startup interface cached data refers to data that was successfully retrieved from the startup interface last time and persisted to the local device, used to quickly provide homepage content when there is no network or network latency.
[0025] S2: In response to reading the startup interface cache data, determine the validity of the startup interface cache data.
[0026] S3: In response to the fact that the startup interface cache data is valid, render and present the complete homepage user interface based on the homepage data model determined by the startup interface cache data.
[0027] It should be noted that the homepage data model refers to the structured object in memory generated by deserializing cached data or network response data, which contains all the content information required to render the homepage.
[0028] S4: While rendering and presenting the homepage user interface, listen for and receive response data for the network request of the startup interface.
[0029] It should be noted that response data refers to the structured data packet returned by the server after the mobile application initiates a specific "startup interface" network call to the server during the cold start phase.
[0030] S5: Perform a differential comparison between the response data and the currently displayed homepage data model. In response to data changes in the differential comparison results, refresh the homepage user interface based on the changed data.
[0031] It should be noted that differential comparison refers to the process of structurally comparing network response data with the currently displayed data model to identify data changes such as additions, deletions, and modifications; data change refers to the effective differences between old and new data found in the differential comparison, including changes that require interface updates such as content updates and structural changes; refresh refers to updating the interface content in a way that is imperceptible or minimally perceptible to the user based on data changes, including operations such as text replacement, image updates, and adding or deleting list items, to maintain interface smoothness.
[0032] In the above implementation, by executing network requests and runtime environment initialization in parallel, preloading data in the early stages of application startup, and using cached data for real-time homepage rendering, a "second-opening" experience is achieved, eliminating the main delay of users waiting for network responses. The timeliness of data is ensured through silent asynchronous updates, balancing startup speed and information timeliness. Through built-in cache validity verification and fault tolerance mechanisms, a stable and usable homepage is guaranteed even in the event of network anomalies, improving application robustness and user satisfaction.
[0033] In some specific implementations, in response to receiving a cold start command, during the execution phase of the mobile application's application startup callback method, multiple speed optimization tasks are executed asynchronously and concurrently, including: Based on the first background thread, a request object is constructed to initiate a network request to the server for obtaining dynamic data from the homepage, and a network response callback is registered. The request object includes device identifier and version parameters, such as version number and user token. Registering a network response callback means registering a network callback processor to prepare to receive response data. Based on the second background thread, the local persistent storage is accessed according to the preset cache key to read the startup interface cache data and associated metadata, and the startup interface cache data is deserialized to generate the homepage data model. The preset cache key can be home_cache_v2. Deserialization refers to the process of converting the previously successfully cached startup interface data in the local cache into a structured homepage data model that the application can recognize and can be directly used for homepage rendering. This is a common method, and the specific process will not be described in detail here. The associated metadata includes cache timestamp, data version number, data structure hash value, etc. The response data of the network request to the startup interface and the homepage data model are stored in a thread-safe data container, such as a dictionary protected by a serial queue, and the corresponding task completion status is updated.
[0034] In some specific implementations, the speed optimization task also includes basic runtime environment initialization. In response to receiving a cold start command, during the execution phase of the mobile application's application startup callback method, multiple speed optimization tasks are executed asynchronously and concurrently, including: Based on the third background thread and the preset configuration list, the basic and necessary runtime environment initialization tasks are identified. The basic and necessary runtime environment refers to components that do not depend on user state, network connection or external data, and the application cannot perform basic functions normally without them. They are usually marked by static configuration lists or feature annotations. Initialization tasks may include the initialization of the core framework (such as the system UI framework) and the startup of key services (such as push notification service and keyboard management service). The runtime environment initialization task is decomposed into multiple independent execution units and submitted to the target concurrent queue. That is, the third background thread executes the runtime environment initialization task asynchronously. For execution units with sequential dependencies, their execution order is controlled by task synchronization primitives, while execution units without dependencies are executed concurrently. In response to the fact that all of the multiple independent execution units are in a completed state, it is determined that the basic operating environment initialization is complete, and the basic operating environment ready flag is set. In response to the completion of the basic operating environment readiness flag setting, an environment readiness event is broadcast to the system.
[0035] Specifically, the above steps constitute the preloading and parallel startup phase, which includes: in response to the application cold start instruction, in the early stages of the application lifecycle (specifically during the execution of the application:didFinishLaunchingWithOptions: method), the following tasks are executed asynchronously and concurrently: performing basic, necessary runtime environment initialization; initiating a parallel "startup interface" request to the server to obtain dynamic homepage data; and asynchronously reading the previously successfully cached startup interface data and homepage data model from the local cache.
[0036] In some specific embodiments, before deserializing the startup interface cache data to generate the homepage data model, the method further includes: The validity of the startup interface cache data is determined based on the metadata associated with the startup interface cache data, wherein the metadata includes at least a cache timestamp and a data structure version identifier; Based on the cache timestamp and the data structure version identifier, the startup interface cache data is subjected to timeliness and version compatibility checks, respectively. Integrity and key field checks are also performed on the startup interface cache data. Specifically, integrity checks verify the storage integrity and data format parsability of the startup interface cache data; if the data is corrupted or parsing fails, it is deemed invalid. Timeliness checks calculate the cache age based on the cache timestamp and compare it with a predefined cache validity period threshold; if the cache age exceeds the validity period threshold, it is deemed invalid. Version compatibility checks compare the data structure version identifier with the range of data structure versions supported by the current application version; if the version identifier is not within the supported range, it is deemed invalid. Key field checks retrieve one or more predefined key business fields from the startup interface cache data; if any key business field is missing or empty, it is deemed invalid. If the timeliness check, version compatibility check, integrity check, and key field check are all successful, it is determined that the startup interface cache data is valid. In response to the fact that the startup interface cache data is valid, the startup interface cache data is deserialized to generate the homepage data model.
[0037] In some specific implementations, in response to the validity of the startup interface cache data, rendering and presenting the complete homepage user interface based on the homepage data model generated by deserializing the startup interface cache data includes: The overall framework structure of the homepage is rendered based on the layout configuration data of the homepage data model. The overall framework structure of the homepage includes the position coordinates, size ratios, and hierarchical relationships of the top navigation bar, the middle content area, and the bottom function bar. The functional components of the homepage are initialized based on the attribute data of the functional components of the homepage data model. The functional components include the banner carousel component, the list display component, the style parameters of the button control, and the response logic binding, etc. Based on the homepage data model, content display data is loaded, including the font, color, and layout rendering of text content, local cache reading or placeholder image loading of image resources, and initial preparation of multimedia content. The interactive control state data based on the homepage data model sets basic interactive attributes, including button clickable state, list scrollable state, and pop-up window default hidden state, etc. In response to the completion of rendering of the overall homepage framework, initialization of the homepage functional components, loading of the content display data, and setting of the basic interactive attributes, the complete homepage user interface is presented on the display screen.
[0038] In some specific implementations, while rendering and presenting the homepage user interface, listening to and receiving the response data of the launch interface network request, and performing a differential comparison between the response data and the currently displayed homepage data model includes: A listening channel is established at the same time as the launch interface network request is initiated, and the response data of the launch interface network request is captured and forwarded at the same time as or after the homepage user interface. In response to listening to and receiving the response data of the network request of the startup interface, the response data and the currently displayed homepage data model are transformed in form, that is, the two are transformed into a unified intermediate representation, such as flattening the nested objects into a set of key-value pairs, or converting them into the same data tree structure, and generating a first dataset and a second dataset that can be used for comparison respectively. The differential comparison is performed on the corresponding field and / or node values in the first dataset and the second dataset to determine the changed field and / or changed node values. The changed field and / or changed node values are defined as the differential comparison results. That is, the differential comparison includes field-level comparison: traversing all comparable fields (or nodes) of the two data objects, comparing whether their values are equal for each field, directly comparing basic types (strings, numbers, booleans), and performing deep comparison or reference comparison for complex types (arrays, objects); structural change detection: identifying the addition or deletion of data in terms of structure, such as adding a list item or deleting an existing field in the response data; efficient comparison of list data: for common list data (such as article lists), a comparison strategy based on unique identifiers (such as id) is adopted. By establishing an old list id set and a new list id set, newly added items and deleted items are quickly identified, and field-level content comparison is performed on common id items. Based on this, the differential comparison results are determined, such as the changed field path, change type (update, addition, deletion), old value and new value, and the identifier of the affected interface component, etc.
[0039] In some specific implementations, refreshing the homepage user interface based on the changed data in response to data changes in the differential comparison results includes: In response to data changes in the differential comparison results, the differential comparison results are analyzed to determine the content that needs to be refreshed. For example, changes in certain fields that are only used for backend management are ignored, or only when the change of a key field exceeds a threshold (such as a price change exceeding 5%), it is marked as a valid difference to trigger an interface update. The homepage user interface is refreshed based on the content that needs to be refreshed, and the latest received data is stored in the database to overwrite the old cached data.
[0040] Specifically, the above steps constitute the cache-first, real-time rendering phase, which includes: In the view loading method (viewDidLoad) of the application's first view controller (homeViewController), the following operations are performed: Without waiting for the response to the "startup interface" request, the cached data being read is checked for validity. If the cached data is valid, this cached data model is used immediately to fully render and present the homepage user interface. At this point, the user sees the complete homepage content for the first time after a cold start, achieving a "second-open" experience. The above steps also include: a silent asynchronous update and cache synchronization phase, which specifically involves listening for the response to the initiated "startup interface" request. When the latest data from the server is received, it is compared with the currently displayed cached data. If the data is updated, the interface is refreshed in a way that is imperceptible or minimally perceptible to the user (without refresh animation, or only a local smooth update of incremental content), replacing it with the latest data. The received latest data is persisted to the local cache, overwriting the old cache, in preparation for the next cold start.
[0041] The aforementioned method for optimizing the cold start speed of mobile applications includes: in response to receiving a cold start instruction, during the execution phase of the application startup callback method of the mobile application, multiple speed optimization tasks are executed asynchronously and concurrently. These speed optimization tasks include at least initiating a network request to the startup interface to obtain dynamic homepage data and reading cached startup interface data; in response to reading the cached startup interface data, the validity of the cached startup interface data is determined; in response to the validity of the cached startup interface data, a complete homepage user interface is rendered and presented based on the homepage data model determined by the cached startup interface data; simultaneously with or after rendering and presenting the homepage user interface, the response data of the network request to the startup interface is listened to and received; the response data is compared with the currently displayed homepage data model using a differential comparison method; in response to data changes in the differential comparison result, the homepage user interface is refreshed based on the changed data. This application completely eliminates the main time users spend waiting for network data by "forwarding" the network request to the startup phase and executing it in parallel with UI initialization, combined with a "caching-first" rendering strategy. From the moment a user clicks the icon to seeing a content-rich homepage, the perceived time is close to the UI framework's rendering time, achieving true "instant opening." The cold start process has been restructured from "serial waiting" to "parallel preloading, cache fallback, and asynchronous updates," ensuring users always have content to view. Subsequent data updates are smooth and seamless, avoiding the disjointed experience of "white screen -> loading -> sudden full refresh" found in other solutions, resulting in an extremely smooth user experience. This application incorporates a cache fallback mechanism, ensuring users instantly see a usable homepage with historical data even in extremely poor network conditions or when the "startup interface" request fails, greatly improving application stability and user satisfaction. This application fully utilizes the CPU time and network bandwidth that are not effectively used during the initial cold start phase, maximizing system resource scheduling efficiency.
[0042] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order in which these steps are executed, and they can be performed in other orders. Furthermore, Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0043] In one embodiment, such as Figure 3 As shown, a mobile application cold start speed optimization device is provided, comprising: The first processing module is used to respond to receiving a cold start instruction and asynchronously and concurrently execute multiple speed optimization tasks during the execution phase of the application startup callback method of the mobile application. The speed optimization tasks include at least initiating a network request to the startup interface for obtaining dynamic data of the homepage and reading cached data of the startup interface. The second processing module is used to determine the validity of the startup interface cache data in response to reading the startup interface cache data; The third processing module is used to render and present the complete homepage user interface based on the homepage data model determined by the startup interface cache data in response to the fact that the startup interface cache data is valid. The fourth processing module is used to listen for and receive response data of the network request of the startup interface while rendering and presenting the homepage user interface; The fifth processing module is used to perform a differential comparison between the response data and the currently displayed homepage data model, and refresh the homepage user interface based on the data changes in the differential comparison results.
[0044] In a preferred embodiment of the present invention, the first processing module is specifically used for: Based on the first background thread, a request object is constructed to initiate a network request to the server for obtaining dynamic data from the homepage, and a network response callback is registered. The request object includes a device identifier and version parameters. Based on the second background thread, the local persistent storage is accessed according to the preset cache key, the startup interface cache data and associated metadata are read, and the startup interface cache data is deserialized to generate the homepage data model. The response data of the network request to the startup interface and the homepage data model are stored in a thread-safe data container, and the corresponding task completion status is updated.
[0045] In a preferred embodiment of the present invention, the first processing module is further configured to: Based on the preset configuration list, identify the runtime environment initialization tasks that are marked as basic and necessary; The runtime environment initialization task is decomposed into multiple independent execution units and submitted to a target concurrent queue for asynchronous execution of the runtime environment initialization task; In response to the fact that all of the multiple independent execution units are in a completed state, it is determined that the basic operating environment initialization is complete, and the basic operating environment ready flag is set. In response to the completion of the basic operating environment readiness flag setting, an environment readiness event is broadcast to the system.
[0046] In a preferred embodiment of the present invention, the second processing module is specifically used for: The validity of the startup interface cache data is determined based on the metadata associated with the startup interface cache data, wherein the metadata includes at least a cache timestamp and a data structure version identifier; Based on the cache timestamp and the data structure version identifier, the timeliness and version compatibility of the startup interface cache data are checked respectively, and the integrity and key field checks are performed based on the startup interface cache data. If the timeliness check, version compatibility check, integrity check, and key field check are all successful, it is determined that the startup interface cache data is valid. In response to the fact that the startup interface cache data is valid, the startup interface cache data is deserialized to generate the homepage data model.
[0047] In a preferred embodiment of the present invention, the third processing module is specifically used for: The overall framework structure of the homepage is rendered based on the layout configuration data of the homepage data model. Initialize the homepage's functional components based on the functional component attribute data of the aforementioned homepage data model; Based on the aforementioned homepage data model, load and display content data; The basic interactive attributes are set based on the state data of the interactive controls according to the homepage data model. In response to the completion of rendering of the overall homepage framework, initialization of the homepage functional components, loading of the content display data, and setting of the basic interactive attributes, the complete homepage user interface is presented on the display screen.
[0048] In a preferred embodiment of the present invention, the fourth processing module is specifically used for: A listening channel is established at the same time as the launch interface network request is initiated, and the response data of the launch interface network request is captured and forwarded at the same time as or after the homepage user interface. In response to listening to and receiving the response data of the network request of the startup interface, the response data is transformed with the currently displayed homepage data model to generate a first dataset and a second dataset that can be compared. Perform differential comparison on the corresponding field and / or node values in the first dataset and the second dataset to determine the changed field and / or changed node values, and define the changed field and / or changed node values as the differential comparison result.
[0049] In a preferred embodiment of the present invention, the fifth processing module is specifically used for: In response to data changes in the differential comparison results, the differential comparison results are analyzed to determine the content that needs to be refreshed; The homepage user interface is refreshed based on the content that needs to be refreshed, and the latest received data is stored in the database to overwrite the old cached data.
[0050] Specific limitations regarding the mobile application cold start speed optimization device can be found in the limitations of the mobile application cold start speed optimization method described above, and will not be repeated here. Each module in the aforementioned mobile application cold start speed optimization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0051] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for optimizing the cold start speed of mobile applications. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0052] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0053] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: S1: In response to receiving a cold start instruction, during the execution phase of the application startup callback method of the mobile application, multiple speed optimization tasks are executed asynchronously and concurrently. The speed optimization tasks include at least initiating a network request to the startup interface for obtaining dynamic data of the homepage and reading cached data of the startup interface. S2: In response to reading the startup interface cache data, determine the validity of the startup interface cache data; S3: In response to the fact that the startup interface cache data is valid, render and present the complete homepage user interface based on the homepage data model determined by the startup interface cache data; S4: While rendering and presenting the homepage user interface, listen for and receive the response data of the network request of the startup interface; S5: Perform a differential comparison between the response data and the currently displayed homepage data model. In response to data changes in the differential comparison results, refresh the homepage user interface based on the changed data.
[0054] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor: S1: In response to receiving a cold start instruction, during the execution phase of the application startup callback method of the mobile application, multiple speed optimization tasks are executed asynchronously and concurrently. The speed optimization tasks include at least initiating a network request to the startup interface for obtaining dynamic data of the homepage and reading cached data of the startup interface. S2: In response to reading the startup interface cache data, determine the validity of the startup interface cache data; S3: In response to the fact that the startup interface cache data is valid, render and present the complete homepage user interface based on the homepage data model determined by the startup interface cache data; S4: While rendering and presenting the homepage user interface, listen for and receive the response data of the network request of the startup interface; S5: Perform a differential comparison between the response data and the currently displayed homepage data model. In response to data changes in the differential comparison results, refresh the homepage user interface based on the changed data.
[0055] In one embodiment, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, performs the following steps: S1: In response to receiving a cold start instruction, during the execution phase of the application startup callback method of the mobile application, multiple speed optimization tasks are executed asynchronously and concurrently. The speed optimization tasks include at least initiating a network request to the startup interface for obtaining dynamic data of the homepage and reading cached data of the startup interface. S2: In response to reading the startup interface cache data, determine the validity of the startup interface cache data; S3: In response to the fact that the startup interface cache data is valid, render and present the complete homepage user interface based on the homepage data model determined by the startup interface cache data; S4: While rendering and presenting the homepage user interface, listen for and receive the response data of the network request of the startup interface; S5: Perform a differential comparison between the response data and the currently displayed homepage data model. In response to data changes in the differential comparison results, refresh the homepage user interface based on the changed data.
[0056] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0057] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0058] The embodiments described above are merely examples of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application.
Claims
1. A method for optimizing the cold start speed of mobile applications, characterized in that, The method includes: In response to receiving a cold start command, during the execution phase of the application startup callback method of the mobile application, multiple speed optimization tasks are executed asynchronously and concurrently. The speed optimization tasks include at least initiating a network request to the startup interface to obtain dynamic data of the homepage and reading cached data of the startup interface. In response to reading the startup interface cache data, determine the validity of the startup interface cache data; If the startup interface cache data is valid, the homepage data model determined based on the startup interface cache data is rendered and the complete homepage user interface is presented. While rendering and presenting the homepage user interface, listen for and receive response data for the network request of the startup interface; The response data is compared with the currently displayed homepage data model. In response to data changes in the comparison results, the homepage user interface is refreshed based on the changed data.
2. The method for optimizing cold start speed of mobile applications according to claim 1, characterized in that, In response to receiving a cold start command, during the execution phase of the mobile application's application startup callback method, multiple speed optimization tasks are executed asynchronously and concurrently, including: Based on the first background thread, a request object is constructed to initiate a network request to the server for obtaining dynamic data from the homepage, and a network response callback is registered. The request object includes a device identifier and version parameters. Based on the second background thread, the local persistent storage is accessed according to the preset cache key, the startup interface cache data and associated metadata are read, and the startup interface cache data is deserialized to generate the homepage data model. The response data of the network request to the startup interface and the homepage data model are stored in a thread-safe data container, and the corresponding task completion status is updated.
3. The method for optimizing cold start speed of mobile applications according to claim 1 or 2, characterized in that, Speed optimization tasks also include basic runtime environment initialization. In response to receiving a cold start command, during the execution phase of the mobile application's application startup callback method, multiple speed optimization tasks are executed asynchronously and concurrently, including: Based on the preset configuration list, identify the runtime environment initialization tasks that are marked as basic and necessary; The runtime environment initialization task is decomposed into multiple independent execution units and submitted to a target concurrent queue for asynchronous execution of the runtime environment initialization task; In response to the fact that all of the multiple independent execution units are in a completed state, it is determined that the basic operating environment initialization is complete, and the basic operating environment ready flag is set. In response to the completion of the basic operating environment readiness flag setting, an environment readiness event is broadcast to the system.
4. The method for optimizing cold start speed of mobile applications according to claim 2, characterized in that, Before deserializing the cached data of the startup interface to generate the homepage data model, the method further includes: The validity of the startup interface cache data is determined based on the metadata associated with the startup interface cache data, wherein the metadata includes at least a cache timestamp and a data structure version identifier; Based on the cache timestamp and the data structure version identifier, the timeliness and version compatibility of the startup interface cache data are checked respectively, and the integrity and key field checks are performed based on the startup interface cache data. If the timeliness check, version compatibility check, integrity check, and key field check are all successful, it is determined that the startup interface cache data is valid. In response to the fact that the startup interface cache data is valid, the startup interface cache data is deserialized to generate the homepage data model.
5. The method for optimizing cold start speed of mobile applications according to claim 1 or 4, characterized in that, In response to the validity of the startup interface cache data, the rendering and presentation of the complete homepage user interface based on the homepage data model generated by deserializing the startup interface cache data includes: The overall framework structure of the homepage is rendered based on the layout configuration data of the homepage data model. Initialize the homepage's functional components based on the functional component attribute data of the aforementioned homepage data model; Based on the aforementioned homepage data model, load and display content data; The basic interactive attributes are set based on the state data of the interactive controls according to the homepage data model. In response to the completion of rendering of the overall homepage framework, initialization of the homepage functional components, loading of the content display data, and setting of the basic interactive attributes, the complete homepage user interface is presented on the display screen.
6. The method for optimizing cold start speed of mobile applications according to claim 1, characterized in that, While rendering and presenting the homepage user interface, or afterward, listening for and receiving response data from the network request of the launch interface, and performing a differential comparison between the response data and the currently displayed homepage data model includes: A listening channel is established at the same time as the launch interface network request is initiated, and the response data of the launch interface network request is captured and forwarded at the same time as or after the homepage user interface. In response to listening to and receiving the response data of the network request of the startup interface, the response data is transformed with the currently displayed homepage data model to generate a first dataset and a second dataset that can be compared. Perform differential comparison on the corresponding field and / or node values in the first dataset and the second dataset to determine the changed field and / or changed node values, and define the changed field and / or changed node values as the differential comparison result.
7. The method for optimizing cold start speed of mobile applications according to claim 1 or 6, characterized in that, In response to data changes in the differential comparison results, refreshing the homepage user interface based on the changed data includes: In response to data changes in the differential comparison results, the differential comparison results are analyzed to determine the content that needs to be refreshed; The homepage user interface is refreshed based on the content that needs to be refreshed, and the latest received data is stored in the database to overwrite the old cached data.
8. A mobile application cold start speed optimization device, characterized in that, The device includes: The first processing module is used to respond to receiving a cold start instruction and asynchronously and concurrently execute multiple speed optimization tasks during the execution phase of the application startup callback method of the mobile application. The speed optimization tasks include at least initiating a network request to the startup interface for obtaining dynamic data of the homepage and reading cached data of the startup interface. The second processing module is used to determine the validity of the startup interface cache data in response to reading the startup interface cache data; The third processing module is used to render and present the complete homepage user interface based on the homepage data model determined by the startup interface cache data in response to the fact that the startup interface cache data is valid. The fourth processing module is used to listen for and receive response data of the network request of the startup interface while rendering and presenting the homepage user interface; The fifth processing module is used to perform a differential comparison between the response data and the currently displayed homepage data model, and refresh the homepage user interface based on the data changes in the differential comparison results.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.