Activity data loading method, device, electronic device and storage medium

The server sends activity notification messages in batches, streamlines and sorts activity data, and performs group loading, solving the problem of slow concurrent loading of activity data in terminal applications, and improving loading efficiency and user experience.

CN118377548BActive Publication Date: 2025-05-23CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410356691.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2025-05-23
Estimated Expiration
2044-03-27

AI Technical Summary

Technical Problem

In terminal applications, when active data is loaded in a large number of concurrently, the loading speed is slow and may fail, resulting in the user experience being affected.

Method used

The server sends activity notification messages in batches, and wakes up the active application in advance; streamlines the activity data and uses binary data streams to represent configuration data; sorts and group loads the received activity data, and loads each group of activity data in sequence according to the arrangement order.

Benefits of technology

It avoids data congestion caused by the simultaneous startup of multiple terminal applications, reduces the amount of active data, improves the loading efficiency of active data, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118377548B_ABST
    Figure CN118377548B_ABST
Patent Text Reader

Abstract

The present application relates to the field of terminal technology, and provides an activity data loading method, device, electronic device and storage medium. The method sends activity notification messages in batches through a server to pre-awaken the activity application before the activity starts, avoiding data congestion caused by the simultaneous startup of multiple terminal applications; at the same time, the configuration data of the activity is streamlined, and the configuration data is represented in the form of a binary data stream, which reduces the amount of activity data and further avoids data congestion caused by the simultaneous transmission of a large amount of data; further, the received activity data is sorted and loaded in groups, avoiding the slow loading speed or even loading failure caused by the simultaneous loading of a large amount of activity data on the terminal, thereby improving the efficiency of activity data loading and enhancing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to an activity data loading method, device, electronic device and storage medium. Background Art

[0002] In terminal applications, it is a common approach to store the configuration and key data required by the application on the server so that it can be updated at any time, and then download and update it to the terminal when the application is started. However, this approach has some problems.

[0003] For example, when a vehicle operator holds a centralized event, such as a car race or a large auto show at the same venue, multiple users' applications will simultaneously send network requests to connect to the server. At this time, each user's terminal may need to connect to the same base station, and the application may have just been opened and needs to download initial data, which can easily cause congestion in the mobile data network. In the end, the experience of all users is seriously affected, including slow initialization and page freezes when browsing list data. Summary of the invention

[0004] In view of this, embodiments of the present application provide an activity data loading method, device, electronic device and storage medium to solve the problem in the prior art that when a large amount of activity data is loaded concurrently, the loading speed is slow and may fail.

[0005] In a first aspect of an embodiment of the present application, a method for loading activity data is provided. The method is executed by a terminal, and the terminal includes an activity application for transmitting and processing activity data. The method includes:

[0006] Receive activity notification messages sent by the server to wake up the active application. The activity notification messages are sent by the server in batches;

[0007] receiving activity data sent by the server, the activity data at least including configuration data, the configuration data being represented by a binary data stream, the binary data stream including at least one group of sequentially arranged values, each group of values ​​representing one item of configuration data;

[0008] Sorting the received activity data, and grouping the sorted data to obtain at least one group of activity data arranged in sequence;

[0009] Load each group of activity data in sequence according to the arrangement order.

[0010] According to a second aspect of an embodiment of the present application, there is provided an activity data loading device, comprising:

[0011] The communication module is configured to receive an activity notification message sent by the server to wake up the active application in the terminal, and the activity notification message is sent by the server in batches;

[0012] The communication module is further configured to receive activity data sent by the server, the activity data at least including configuration data, the configuration data being represented by a binary data stream, the binary data stream including at least one group of sequentially arranged values, each group of values ​​representing one item of configuration data;

[0013] A sorting module is configured to sort the received activity data and group the sorted data to obtain at least one group of activity data arranged in sequence;

[0014] The loading module is configured to sequentially load each group of activity data according to the arrangement order.

[0015] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0016] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0017] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the embodiments of the present application send activity notification messages in batches through the server to pre-wake up the activity application before the activity starts, thereby avoiding data congestion caused by the simultaneous startup of multiple terminal applications; at the same time, the activity configuration data is streamlined and the configuration data is represented in the form of a binary data stream, thereby reducing the amount of activity data and further avoiding data congestion caused by the simultaneous transmission of a large amount of data; further, the received activity data is sorted and loaded in groups, thereby avoiding slow loading speed or even loading failure caused by the simultaneous loading of a large amount of activity data on the terminal, thereby improving the activity data loading efficiency and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 It is a scenario diagram of an application scenario of an embodiment of the present application.

[0020] Figure 2 It is a flowchart of an activity data loading method provided in an embodiment of the present application.

[0021] Figure 3 It is a flowchart of a method for sorting received activity data provided in an embodiment of the present application.

[0022] Figure 4 It is a flowchart of a method provided in an embodiment of the present application for grouping sorted data to obtain at least one group of activity data arranged in sequence.

[0023] Figure 5 It is a flowchart of another activity data loading method provided in an embodiment of the present application.

[0024] Figure 6 It is a flowchart of a method for determining a preset speed threshold provided in an embodiment of the present application.

[0025] Figure 7 It is a flowchart of a method for obtaining the cell height of display list data provided in an embodiment of the present application.

[0026] Figure 8 It is a schematic diagram of an active data loading device provided in an embodiment of the present application.

[0027] Fig. 9 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0029] A method and device for loading activity data according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0030] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.

[0031] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the electronic devices as described above. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0032] The server 4 may be a server that provides various services, for example, a background server that sends messages or data to a terminal device that establishes a communication connection with it. The server 4 may be a single server, a server cluster composed of several servers, or a cloud computing service center, which is not limited in the present application.

[0033] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present application are not limited to this.

[0034] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.

[0035] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc. Specifically, the user can receive notification messages, activity data, etc. from the server 4 through the terminal devices 1, 2 and 3, and can also receive updated data from the server 4 in real time through the terminal devices 1, 2 and 3 when the activity data is updated.

[0036] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.

[0037] As mentioned above, in terminal applications, it is a common approach to store the configuration and key data required by the application on the server so that it can be updated at any time, and then download and update it to the terminal when the application is started. However, this approach has some problems.

[0038] For example, when a vehicle operator holds a centralized event, such as a car race or a large auto show at the same venue, multiple users' applications will simultaneously send network requests to connect to the server. At this time, each user's terminal may need to connect to the same base station, and the application may have just been opened and needs to download initial data, which can easily cause congestion in the mobile data network. In the end, the experience of all users is seriously affected, including slow initialization and page freezes when browsing list data.

[0039] In view of this, an embodiment of the present application provides an activity data loading method, in which the server sends activity notification messages in batches to pre-wake up the activity application before the activity starts, so as to avoid data congestion caused by the simultaneous startup of multiple terminal applications; at the same time, the activity configuration data is streamlined and the configuration data is represented in the form of a binary data stream, thereby reducing the amount of activity data and further avoiding data congestion caused by the simultaneous transmission of a large amount of data; further, the received activity data is sorted and loaded in groups, thereby avoiding the slow loading speed or even loading failure caused by the simultaneous loading of a large amount of activity data on the terminal, thereby improving the activity data loading efficiency and enhancing the user experience.

[0040] Figure 2 It is a flowchart of an activity data loading method provided in an embodiment of the present application. Figure 2 The active data loading method can be Figure 1 The terminal device is executed. Figure 2 As shown, the method comprises the following steps:

[0041] In step S201, an activity notification message sent by a server is received to wake up the activity application.

[0042] Among them, the activity notification messages are sent by the server in batches.

[0043] In step S202, activity data sent by the server is received.

[0044] The activity data at least includes configuration data, and the configuration data is represented by a binary data stream. The binary data stream includes at least one group of sequentially arranged values, and each group of values ​​represents one item of configuration data.

[0045] In step S203, the received activity data is sorted, and the sorted data is grouped to obtain at least one group of activity data arranged in sequence.

[0046] In step S204, each group of activity data is loaded in sequence according to the arrangement order.

[0047] In the embodiment of the present application, the method may be executed by a terminal. Further, an activity application may be installed in the terminal for transmitting and processing activity data.

[0048] In an embodiment of the present application, before the activity starts, the terminal can receive an activity notification message sent by the server to wake up the activity application. Among them, the terminal can be the terminal of the user participating in the activity. Taking the auto show event held by a certain brand of vehicle supplier as an example, the users participating in the event can be: potential users who are interested in purchasing the brand of vehicle obtained by statistics, owners of the brand of vehicle, intended users obtained from third-party channels, and other users. The server can manage and notify these users in a unified manner to achieve the purpose of communicating with them. The form of notification includes but is not limited to telephone, SMS contact, game and client contact, wherein the client contact includes but is not limited to contact through terminal application, contact through mini program and contact through official account. Among them, the method of contacting through terminal application is preferred, which can communicate with users in various forms such as remote notification or active notification in the application, and can obtain user feedback.

[0049] Furthermore, after determining the users who will participate in the event, the server can send event notification messages to the users in batches before the event starts. For example, if it is estimated that there are 2,000 users participating in the event, the server can send an event notification to the first 100 users in the user list participating in the event 20 minutes before the event starts, and send an event notification to the next 100 users in the user list 19 minutes before the event starts, and so on until all users in the user list have been sent event notifications. After receiving the event notification, if the activity application has not yet been started, the user's terminal can perform a cold start to load the cold start data; if the application activity is in the background running state, a hot start can be performed to load the hot start data. This method can stagger the time for multiple terminals to load the startup data in the activity data, and avoid slow loading or loading failure of the activity data caused by communication data congestion in the time dimension.

[0050] In the embodiment of the present application, after the activity starts, the terminal can also receive activity data sent by the server, wherein the activity data at least includes configuration data, the configuration data is represented by a binary data stream, the binary data stream includes at least one group of sequentially arranged values, and each group of values ​​represents one configuration data.

[0051] It is understandable that the configuration data of the activity application is usually a string described in a format such as json, xml, etc., so as to facilitate user reading. However, in reality, these configuration data do not need to be read by the user, and are usually parsed and executed by a computer program in the terminal. Therefore, the configuration data can be compressed and its length can be modified to be the simplest to reduce the amount of activity data.

[0052] In one example, if the configuration data in the activity data is {"service switch A": true, "service switch B": false, "certain configuration": 3}, it can be simplified into a binary data stream "1, 0, 11", where "1", "0" and "11" are each a set of values, which are the configuration data of service switch A, service switch B and certain configuration respectively. Further, since service switch A is at the first position of the binary data stream, because its value is true or false, its value is represented by 1 bit, and because the value of A is true, the value of the first bit of the binary data stream is 1. Since service switch B is at the second position of the data string, because its value is true or false, its value is represented by 1 bit, and because the value of B is false, the value of the second bit of the binary data stream is 0. Since certain configuration is at the third to fourth positions of the data, because its value range is 0-3, its value is represented by 2 bits, and because the value is 3, the value of the third to fourth bits of the binary data stream is 11.

[0053] It should be noted that the binary data stream may also be represented in other ways such as octal or hexadecimal, which is not limited here. In this way, the volume of the activity data can be compressed, and the efficiency of activity data transmission can be improved in the data dimension.

[0054] In an embodiment of the present application, the terminal can sort the received activity data, and group the sorted data to obtain at least one group of activity data arranged in sequence. That is to say, after obtaining the activity data, especially the activity data of the list data type, the terminal can first sort the data, and load the activity data in the sorted order, which can optimize the activity data loading process and further improve the loading efficiency. At the same time, when the amount of activity data is large, the sorted activity data can also be grouped to obtain at least one group of activity data arranged in sequence, and each group of activity data is loaded in sequence according to the arrangement order, thereby optimizing the activity data loading steps in the data loading dimension and improving the recording efficiency.

[0055] According to the technical solution provided in the embodiment of the present application, activity notification messages are sent in batches by the server to pre-wake up the activity application before the activity starts, thereby avoiding data congestion caused by the simultaneous startup of multiple terminal applications; at the same time, the activity configuration data is streamlined and represented in the form of a binary data stream, thereby reducing the amount of activity data and further avoiding data congestion caused by the simultaneous transmission of a large amount of data; further, the received activity data is sorted and loaded in groups, thereby avoiding slow loading speed or even loading failure caused by the simultaneous loading of a large amount of activity data on the terminal, thereby improving the activity data loading efficiency and enhancing the user experience.

[0056] In the embodiment of the present application, when the terminal receives the activity notification message, it can notify the user by popping up a banner advertisement (banner) or sending a prompt tone, and the user wakes up the activity application by clicking the activity notification message.

[0057] Furthermore, the activity notification message may also be a silent notification message. After receiving the silent notification message, the terminal may only start the activity application without sending a prompt message to the user. In this case, the activity application starts automatically without the user having any perception.

[0058] Taking the implementation in the iPhone Operate System (iOS) as an example, the server can send a senseless remote notification in the following way: when sending an activity notification, in the remote notification of iOS, such as the Apple Push Notification service (APNS), set the content-available attribute of the field payload to 1, so that the notification can be directly delivered to the activity application without prompting the user. At this time, regardless of whether the activity application in the user terminal has been started, after receiving the activity notification, the activity application is started, the corresponding system notification callback function is called, and the data is processed in it.

[0059] In fact, senseless notification can not only wake up active applications in batches, but also solve some difficult problems at any time. For example, some functional modules of vehicle control use tokens with shorter expiration times due to their strong security. For example, if the expiration time of the token is set to 24 hours, it means that after the user logs in, the application can allow the user to log in within 24 hours, but after more than 24 hours, the application will ask the user to log in again. Although the configuration method is safer, the user experience is not good. Therefore, you can send senseless notifications to the user terminal through the server to wake up the application at night when the user is resting. The application directly uses the current token to call the corresponding service on the server, refresh the token expiration time or replace the token. In this way, the user does not need to log in again the next day, which improves the user experience.

[0060] In the embodiment of the present application, the activity data can be further compressed by updating only the incremental data when the activity data is updated. That is, when the activity data is updated, the terminal can receive the compressed incremental data and update the activity data based on the incremental data.

[0061] That is to say, each time the data is updated, only the changed values ​​are updated, and the unchanged values ​​are not updated, so as to further shorten the data transmitted when the active application is started. Among them, updating only the incremental data can be implemented in the following way: a custom database is defined, and the active data is saved in the custom database. For example, the binary data stream data used to represent the configuration data can be saved in the custom database. When the active data is updated, the corresponding data in the custom database is updated, and the updated data is transmitted without transmitting other data. That is, each time the active application is started, only the fields that need to be updated in the database are transmitted. At the same time, the incremental data can be further compressed during the transmission process, and the terminal obtains the compressed incremental data and decompresses it to further reduce the data volume. In this way, not only the optimized use of network data is guaranteed, but also the resource occupation of the terminal is further saved.

[0062] Figure 3 FIG. 1 is a flow chart of a method for sorting received activity data provided by an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:

[0063] In step S301, the data size of the received activity data is calculated.

[0064] In step S302, in response to the data size being smaller than a first preset threshold, the activity data is sorted using an insertion sort algorithm.

[0065] In step S303, in response to the data size being greater than or equal to the first preset threshold and less than the second preset threshold, the activity data is sorted using a merge sort algorithm.

[0066] In step S304, in response to the data size being greater than or equal to a second preset threshold, the activity data is sorted using a dual-pivot quick sort algorithm.

[0067] In an embodiment of the present application, when sorting the received activity data, the data scale of the received activity data can be calculated first. If the data scale is less than the first preset threshold, the activity data can be sorted using an insertion sort algorithm. If the data scale is greater than or equal to the first preset threshold, and less than the second preset threshold, the activity data can be sorted using a merge sort algorithm. If the data scale is greater than or equal to the second preset threshold, the activity data can be sorted using a dual-pivot quick sort algorithm. Among them, the values ​​of the first preset threshold and the second preset threshold are set according to actual needs and are not limited here.

[0068] That is to say, after obtaining the activity data, especially the activity data of the list data type, the terminal can first perform sorting processing, wherein the sorting algorithm can be selected according to the data scale of the activity data. For example, if the activity data is list data and the number of list items is less than 43, the insertion sort algorithm is used first; if the number of list items is greater than or equal to 43 and less than 268, the merge sort algorithm is used first; if the number of list items is greater than 268, the quick sort algorithm is used first, and it is preferred to use the dual-pivot quick sort rather than the single-pivot quick sort.

[0069] Figure 4 1 is a flow chart of a method for grouping sorted data to obtain at least one group of activity data arranged in sequence, provided in an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:

[0070] In step S401, view information of display list data is obtained, and the view information at least includes cell height.

[0071] In step S402, the number of records that the terminal can render in the page each time is calculated based on the cell height.

[0072] In step S403, data of every c times the number of records in the sorted data is taken as a group to obtain at least one group of activity data arranged in sequence.

[0073] Wherein, c is a positive integer greater than 1.

[0074] In an embodiment of the present application, the activity data may be list data. When the sorted data is grouped, the view information for displaying the list data may be first obtained, and the view information may include at least the cell height. Then, the number of records that the terminal can render in the page each time is calculated based on the cell height. The page refers to the display page of the terminal. Finally, the data of each c times the number of records in the sorted data is taken as a group to obtain at least one group of activity data arranged in sequence.

[0075] That is to say, when the terminal loads the list data to display the list data on the list page, for example, when using the presentation chart control (UITableView) for display in the iOS system, it is inefficient to process all the data at the same time. At this time, the data can be loaded step by step for processing. When loading data step by step, first, the number of records n that the device can render can be calculated based on the height of the cell (UITableViewCell). Then, the data of c*n is loaded and processed each time, that is, the data scale of c*n is loaded each time. Among them, the value of c is determined according to actual needs, but it is necessary to satisfy that c*n is less than the total amount of data in the list. In some embodiments, c can be 3, or 4.

[0076] Figure 5 It is a flowchart of another activity data loading method provided in an embodiment of the present application. Figure 5 Steps S501 to S503 in the embodiment shown are Figure 2 Steps S201 to S203 in the illustrated embodiment are substantially the same. Figure 5 Step S505 in the illustrated embodiment is Figure 2 Step S204 in the illustrated embodiment is substantially the same and will not be described in detail herein. Figure 5 As shown, the method also includes the following steps:

[0077] In step S504, in response to determining that an instruction to scroll and display list data is received and the scrolling speed is greater than a preset speed threshold, activity data is not loaded until the scrolling speed is less than or equal to the preset speed threshold.

[0078] Wherein, not loading active data includes: maintaining the current display interface, or calling a preset interface for display. Further, the preset speed threshold is determined based on the data processing time of each cell and the complexity of the cell user interface layout, and the complexity of the cell user interface layout includes at least the number of pictures and / or videos included in the cell user interface.

[0079] In the embodiment of the present application, if the terminal receives a command from the user to scroll the list data, and the scrolling speed is greater than a preset speed threshold, the terminal may not load the active data until the scrolling speed is less than or equal to the preset speed threshold. In other words, if the user scrolls the representation diagram quickly on the terminal interface, the terminal should not load the data immediately, but postpone the process until the scrolling speed drops to the preset speed threshold.

[0080] It should be noted that the execution timing of step S504 is not affected by the execution of step S503. In other words, step S504 is a general optimization step that can be executed at any time when the list is loaded with data. For example, after the list is swiped by the user, step S504 can be executed first to determine whether the scrolling speed of the list data is greater than the preset speed threshold. If not, step S503 is executed to sort and group the active data, and load the grouped data according to demand, for example, loading a data scale of c*n each time.

[0081] Taking the implementation in iOS system as an example, the scrolling speed can be obtained through the sliding proxy function of UIScrollView, the parent class of the general representation diagram. Among them, the sliding proxy function is -(void)scrollViewDidScroll:(UIScrollView*)scrollView. In the sliding proxy function, the scrolling speed can be obtained by using the sliding gesture associated with the table view, that is, the panGestureRecognizer property of the table view, that is, accessing the panGestureRecognizer property of the table view, calling the velocityInView method of the property, and passing the parameter to the parent view of the table view to get the scrolling speed. The calling code is, for example: CGPoint velocity =[tableView.panGestureRecognizer velocityInView:self.view].

[0082] In an embodiment of the present application, not loading active data may mean maintaining the current display interface, or calling a preset interface for display. Among them, calling a preset interface for display may be to predefine a preset interface, and the preset interface may be an interface shell that is used to block the view during the loading period. When the page for acquiring data to be loaded in the terminal initially appears, or the user performs a pull-down or swipe-up operation to acquire new data, the preset interface shell is displayed. When the sliding speed of the user's pull-up or swipe-up decreases to below the sliding threshold, the view is refreshed and the data is filled.

[0083] Among them, taking the implementation in iOS system as an example, refreshing the view can be implemented in the following way: in the cell drawing proxy function of the table view, that is,

[0084] -(UITableViewCell *)tableView:(UITableView *)tableView

[0085] In cellForRowAtIndexPath:(NSIndexPath *)indexPath, the scroll speed is determined. If it is less than the preset speed threshold, the real cell is returned, otherwise the preset interface shell is returned. If the preset speed threshold is 2000, the refresh code is, for example:

[0086] if(fabs(self.velocity.y)>2000) {

[0087] / / Return to the interface shell

[0088] } else {

[0089] / / Return the actual cell

[0090] }

[0091] Among them, fabs() is a system function, which means taking the absolute value of velocity.

[0092] In an embodiment of the present application, the preset speed threshold can be determined based on the data processing time of each cell and the complexity of the cell user interface layout, and the complexity of the cell user interface layout includes at least the number of pictures and / or videos included in the cell user interface.

[0093] Figure 6 is a flow chart of a method for determining a preset speed threshold provided in an embodiment of the present application. Figure 6 As shown, the method comprises the following steps:

[0094] In step S601, the maximum stack space allocated by the terminal system to the active application is obtained.

[0095] In step S602, the estimated capacity of key data of each cell is obtained, where the key data is the data with the largest performance consumption in the active data.

[0096] In step S603, the ratio of the maximum stack space to the estimated capacity of key data is determined as the ideal speed threshold.

[0097] In step S604, statistics are collected on the page loading performance of the terminal, and in response to the statistical result not meeting the preset requirement, the ideal speed threshold is reduced by a preset value.

[0098] In step S605, the operation of performing statistics on the page loading performance of the terminal and reducing the ideal speed threshold by a preset value when the statistical result does not meet the preset requirement is repeatedly performed until the statistical result meets the preset requirement and the preset speed threshold is obtained.

[0099] In an embodiment of the present application, when calculating the preset speed threshold, the maximum stack space allocated by the terminal system for the active application can be first obtained, and the estimated capacity of the key data of each cell can be obtained. Among them, the key data is the data with the largest performance consumption in the active data. Next, the ratio of the maximum stack space to the estimated capacity of the key data can be determined as the ideal speed threshold. Then, the page loading performance of the terminal is counted, and in response to the statistical results not meeting the preset requirements, the ideal speed threshold is reduced by a preset value. Repeat the operation of counting the page loading performance of the terminal and reducing the ideal speed threshold by a preset value when the statistical results do not meet the preset requirements until the statistical results meet the preset requirements, and the preset speed threshold is obtained. Among them, the operation of reducing the ideal speed threshold by a preset value can be to subtract a fixed value or an indefinite value from the ideal speed, or to divide the ideal speed by a fixed value or an indefinite value.

[0100] Taking the implementation in iOS system as an example, we can first obtain the maximum stack space allocated by the main thread, for example, 1M, and obtain the key data of each cell. The key data can be the UI element that takes up the most memory and performance, such as the estimated size of the video. Divide 1M by the estimated size of the key data to get a value as the ideal speed threshold k. Next, reduce k appropriately, for example, subtract 1. Then observe the page performance. For example, you can use tools to count the frame rate of the interface when sliding to determine whether the page performance has improved. If so, it means that the threshold k under this page is valid. If not, continue to reduce k by 1 until the requirement is met.

[0101] Figure 7 is a flow chart of a method for obtaining the cell height of display list data provided in an embodiment of the present application. Figure 7 As shown, the method comprises the following steps:

[0102] In step S701, the pre-stored cell height is obtained from the cache.

[0103] In step S702, the list data item corresponding to the cell is obtained.

[0104] In step S703, in response to the list data item obtained this time being the same as the list data item obtained last time, the pre-stored cell height is obtained from the cache.

[0105] In step S704, in response to the list data item acquired this time being different from the list data item acquired last time, the cell height is calculated according to the list data item acquired this time.

[0106] In the embodiment of the present application, the cell height can be pre-calculated and stored, and the pre-stored cell height can be directly obtained from the cache. On the other hand, if the cell height cannot be pre-calculated, the list data item corresponding to the cell can be obtained first, and then it is determined whether the list data item obtained this time is the same as the list data item obtained last time. If they are the same, the pre-stored cell height is obtained from the cache, and the pre-stored cell height can be the cell height used last time. Conversely, if you do not want to listen, you can calculate the cell height based on the list data item obtained this time.

[0107] That is to say, for the height of each cell, the preferred implementation is to pre-calculate and cache it, and directly assign it to the cell when needed, such as when the system calls the proxy callback function related to the cell height. If the business requirements cannot meet this, and some cells must dynamically calculate the height, they can be processed based on the rule of marking whether the cell data is dirty, that is, first check the list item data corresponding to the cell to determine whether it is the same as the last time; if it is the same, it indicates that the cell does not need to be re-rendered, and the cached height is directly returned; if it is different, it indicates that the cell needs to be rendered, and the cell is marked as dirty, and then calculated and rendered again.

[0108] By adopting the technical solution of the embodiments of the present application, it is possible to stagger the startup of active applications in the time dimension, adopt a variety of measures to compress active data in the data dimension, and improve loading efficiency in the active data loading dimension by optimizing data loading order, grouping loading, etc., which can solve problems such as network congestion, slow loading or even loading failure caused by large concurrency of active data, and improve user experience.

[0109] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0110] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0111] Figure 8 Schematic diagram of an activity data loading device provided in an embodiment of the present application. Figure 8 As shown, the 8 devices include:

[0112] The communication module 801 is configured to receive an activity notification message sent by a server to wake up an active application in the terminal. The activity notification message is sent by the server in batches.

[0113] The communication module 801 is also configured to receive activity data sent by the server, the activity data at least including configuration data, the configuration data is represented by a binary data stream, the binary data stream includes at least one group of sequentially arranged values, each group of values ​​represents one configuration data.

[0114] The sorting module 802 is configured to sort the received activity data and group the sorted data to obtain at least one group of activity data arranged in sequence.

[0115] The loading module 803 is configured to load each group of activity data in sequence according to the arrangement order.

[0116] According to the technical solution provided in the embodiment of the present application, activity notification messages are sent in batches by the server to pre-wake up the activity application before the activity starts, thereby avoiding data congestion caused by the simultaneous startup of multiple terminal applications; at the same time, the activity configuration data is streamlined and represented in the form of a binary data stream, thereby reducing the amount of activity data and further avoiding data congestion caused by the simultaneous transmission of a large amount of data; further, the received activity data is sorted and loaded in groups, thereby avoiding slow loading speed or even loading failure caused by the simultaneous loading of a large amount of activity data on the terminal, thereby improving the activity data loading efficiency and enhancing the user experience.

[0117] In the embodiment of the present application, the activity notification message is a silent notification message. After receiving the silent notification message, the terminal starts the activity application and does not send a prompt message to the user.

[0118] In the embodiment of the present application, in response to an update of the activity data, compressed incremental data is received, and the activity data is updated based on the incremental data.

[0119] In an embodiment of the present application, sorting the received activity data includes: calculating the data scale of the received activity data; in response to the data scale being less than a first preset threshold, using an insertion sort algorithm to sort the activity data; in response to the data scale being greater than or equal to the first preset threshold and less than a second preset threshold, using a merge sort algorithm to sort the activity data; in response to the data scale being greater than or equal to the second preset threshold, using a dual-pivot quick sort algorithm to sort the activity data.

[0120] In an embodiment of the present application, the activity data is list data; the sorted data is grouped to obtain at least one group of activity data arranged in sequence, including: obtaining view information for displaying the list data, the view information at least including the cell height; calculating the number of records that the terminal can render in the page each time based on the cell height; taking the data of every c times the number of records in the sorted data as a group, to obtain at least one group of activity data arranged in sequence, where c is a positive integer greater than 1.

[0121] In an embodiment of the present application, before each group of activity data is loaded in sequence according to the arrangement order, it also includes: in response to determining that an instruction to scroll and display list data is received, and the scrolling speed is greater than a preset speed threshold, not loading the activity data until the scrolling speed is less than or equal to the preset speed threshold; wherein, not loading the activity data includes: maintaining the current display interface, or calling a preset interface for display; the preset speed threshold is determined based on the data processing time of each cell and the complexity of the cell user interface layout, and the complexity of the cell user interface layout includes at least the number of pictures and / or videos included in the cell user interface, the number of levels of the user interface layout, and the number of controls in the user interface.

[0122] In an embodiment of the present application, the preset speed threshold is determined in the following manner: obtaining the maximum stack space allocated by the terminal system for the active application; obtaining the estimated capacity of key data of each cell, where the key data is the data with the largest performance consumption in the active data; determining the ratio of the maximum stack space to the estimated capacity of the key data as the ideal speed threshold; performing statistics on the page loading performance of the terminal, and in response to the statistical results not meeting the preset requirements, subtracting a fixed value or a variable value from the ideal speed by the ideal speed threshold; repeatedly performing statistics on the page loading performance of the terminal, and when the statistical results do not meet the preset requirements, subtracting a fixed value or a variable value from the ideal speed by the ideal speed threshold until the statistical results meet the preset requirements, thereby obtaining the preset speed threshold.

[0123] In an embodiment of the present application, obtaining the cell height of displayed list data includes: obtaining a pre-stored cell height from a cache; or obtaining a list data item corresponding to the cell; in response to the list data item obtained this time being the same as the list data item obtained last time, obtaining the pre-stored cell height from the cache; in response to the list data item obtained this time being different from the list data item obtained last time, calculating the cell height according to the list data item obtained this time.

[0124] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0125] Fig. 9 Schematic diagram of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 9 of this embodiment includes: a processor 901, a memory 902, and a computer program 903 stored in the memory 902 and executable on the processor 901. When the processor 901 executes the computer program 903, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 901 executes the computer program 903, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0126] The electronic device 9 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 9 may include, but is not limited to, a processor 901 and a memory 902. Those skilled in the art will appreciate that Fig. 9 The electronic device 9 is merely an example and does not limit the electronic device 9 , and may include more or less components than those shown in the figure, or different components.

[0127] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0128] The memory 902 may be an internal storage unit of the electronic device, for example, a hard disk or memory of the electronic device 9. The memory 902 may also be an external storage device of the electronic device 9, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 9. The memory 902 may also include both an internal storage unit of the electronic device 9 and an external storage device. The memory 902 is used to store computer programs and other programs and data required by the electronic device.

[0129] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0130] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0131] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for loading activity data, characterized in that: The method is performed by a terminal, the terminal includes an activity application, and is used to transmit and process data of the activity, and the terminal is a terminal of a user who participates in the activity; The method comprises: receiving an activity notification message sent by a server to wake up the activity application, wherein the activity notification message is sent by the server in batches; Receiving activity data sent by a server, the activity data at least comprising configuration data, the configuration data being represented by a binary data stream, the binary data stream comprising at least one group of sequentially arranged values, each group of values ​​representing one item of configuration data; Sorting the received activity data, and grouping the sorted data to obtain at least one group of activity data arranged in sequence; Load each group of activity data in sequence according to the arrangement order; The activity data is list data; before sequentially loading each group of activity data according to the arrangement order, the method further includes: In response to determining that an instruction to scroll and display the list data is received and the scrolling speed is greater than a preset speed threshold, not loading the activity data until the scrolling speed is less than or equal to the preset speed threshold; The preset speed threshold is determined in the following manner: Obtaining a maximum stack space allocated by the terminal system for the active application; Obtaining an estimated capacity of key data of each cell, wherein the key data is the data with the highest performance consumption among the activity data; Determine the ratio of the maximum stack space to the estimated capacity of the key data as an ideal speed threshold; Collecting statistics on the page loading performance of the terminal, and in response to the statistical result not meeting the preset requirement, reducing the ideal speed threshold by a preset value; The operation of performing statistics on the page loading performance of the terminal and reducing the ideal speed threshold by a preset value when the statistical result does not meet the preset requirement is repeatedly performed until the statistical result meets the preset requirement, thereby obtaining the preset speed threshold.

2. The method according to claim 1, characterized in that The activity notification message is a silent notification message. After receiving the silent notification message, the terminal starts the activity application and does not send a prompt message to the user.

3. The method according to claim 1, characterized in that In response to an update of the active data, compressed incremental data is received, and the active data is updated based on the incremental data.

4. The method according to claim 1, characterized in that: The step of sorting the received activity data comprises: Calculate the data size of the received activity data; In response to the data size being smaller than a first preset threshold, sorting the activity data using an insertion sort algorithm; In response to the data size being greater than or equal to a first preset threshold and less than a second preset threshold, sorting the activity data using a merge sort algorithm; In response to the data size being greater than or equal to a second preset threshold, the activity data is sorted using a dual-pivot quick sort algorithm.

5. The method according to claim 1, characterized in that: The sorted data is grouped to obtain at least one group of activity data arranged in sequence, including: Obtaining view information for displaying the list data, wherein the view information at least includes a cell height; Calculate the number of records that the terminal can render on the page each time based on the cell height; In the sorted data, data of every c times the number of records is taken as a group to obtain at least one group of activity data arranged in the sequence, where c is a positive integer greater than 1.

6. The method according to claim 1, characterized in that Not loading the activity data includes: maintaining the current display interface, or calling a preset interface for display.

7. The method according to claim 5, characterized in that Get the cell height of the display list data, including: Get the pre-stored cell height from the cache; or Get the list data item corresponding to the cell; In response to the list data item obtained this time being the same as the list data item obtained last time, obtaining a pre-stored cell height from a cache; In response to the list data item acquired this time being different from the list data item acquired last time, the cell height is calculated according to the list data item acquired this time.

8. An activity data loading device, characterized in that: include: A communication module is configured to receive an activity notification message sent by a server to wake up an activity application in a terminal, wherein the activity notification message is sent by the server in batches, and the terminal is a terminal of a user participating in the activity; The communication module is further configured to receive activity data sent by the server, the activity data at least including configuration data, the configuration data being represented by a binary data stream, the binary data stream including at least one group of sequentially arranged values, each group of values ​​representing one item of configuration data; A sorting module is configured to sort the received activity data and group the sorted data to obtain at least one group of activity data arranged in sequence; A loading module is configured to sequentially load each group of activity data according to the arrangement order; The activity data is list data; Before loading each set of activity data in order, it also includes: In response to determining that an instruction to scroll and display the list data is received and the scrolling speed is greater than a preset speed threshold, not loading the activity data until the scrolling speed is less than or equal to the preset speed threshold; The preset speed threshold is determined in the following manner: Obtaining a maximum stack space allocated by the terminal system for the active application; Obtaining an estimated capacity of key data of each cell, wherein the key data is the data with the highest performance consumption among the activity data; Determine the ratio of the maximum stack space to the estimated capacity of the key data as an ideal speed threshold; Collecting statistics on the page loading performance of the terminal, and in response to the statistical result not meeting the preset requirement, reducing the ideal speed threshold by a preset value; The operation of performing statistics on the page loading performance of the terminal and reducing the ideal speed threshold by a preset value when the statistical result does not meet the preset requirement is repeatedly performed until the statistical result meets the preset requirement, thereby obtaining the preset speed threshold.

9. An electronic 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, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Mobile communication terminal, information providing system, program, and computer readable recording medium

    CN101715025A

  • Terminal updating method, server and terminal

    CN109743342A