Page loading methods and clients
By utilizing thread independence during the page loading process, the first thread sends page loading requests and the second thread sends initialization information, the problem of long page loading time in the existing technology is solved, and faster page loading efficiency and resource utilization are achieved .
Patent Information
- Application Number
- CN202010230682.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-27
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2040-03-27
AI Technical Summary
The existing page loading method results in longer page loading time when there is a lot of network data.
The page loading request is sent through the first thread, the second thread sends the initialization information, and renders the page when receiving the network data and the initialization architecture, using thread independence to simultaneously transmit the network data and the initialization architecture to shorten the page loading time.
It effectively shortens page loading time, improves page loading efficiency, reduces network overhead and consumption of device resources.
Smart Images

Figure CN113452738B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page loading method and a client. Background Art
[0002] At present, the page loading process of various terminal applications such as shopping applications, information search applications, news applications, etc. is mainly to send a network request after the page architecture is initialized to load network data to the initialized page architecture.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] When there is a lot of network data, the existing loading method results in a longer page loading time. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a page loading method and a client, which can effectively shorten the page loading time.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a page loading method is provided, comprising:
[0007] In response to a trigger of page loading, generating a page loading request and initialization information corresponding to the page loading request;
[0008] Sending the page loading request to the server through a first thread, and sending the initialization information to the server through a second thread;
[0009] When the first thread receives network data corresponding to the page loading request sent by the server, and the second thread receives a page initialization framework corresponding to the initialization information, the page initialization framework is rendered using the network data.
[0010] Preferably, the page loading method further comprises:
[0011] When the first thread receives network data corresponding to the page loading request sent by the server, and the second thread does not receive the page initialization framework corresponding to the initialization information, the network data is stored or cached;
[0012] When the second thread receives the page initialization framework corresponding to the initialization information, the page initialization framework is rendered using the stored or cached network data.
[0013] Preferably, the page loading method,
[0014] Further comprising: maintaining a plurality of preloading tasks for a page, and maintaining a plurality of page initialization blocks and associations between the plurality of page initialization blocks and the plurality of preloading tasks, wherein each of the page initialization blocks is a part of the page initialization architecture;
[0015] The first thread receives network data corresponding to the page loading request sent by the server, including: the first thread receives any one or more network data parts of the preloading task;
[0016] The second thread receives the page initialization framework corresponding to the initialization information, including: the second thread receives any one or more of the page initialization blocks;
[0017] Rendering the page initialization framework includes: using the network data portion to render a page initialization block associated with the network data portion.
[0018] Preferably, the page loading method further comprises:
[0019] When the page loading trigger indicates switching from the current page to the next page,
[0020] It is determined whether the next page has a target page initialization block inherited from the current page. If so, the next page directly inherits the target page initialization block and uses the network data portion associated with the target page initialization block to render the target page initialization block.
[0021] Preferably, the page loading method further comprises: caching the current page into a preset set of visited pages;
[0022] After generating the page loading request and the initialization information corresponding to the page loading request, the method further includes:
[0023] Determine whether there is a target page matching the page loading request and the initialization information in the visited page set,
[0024] If yes, then load the target page;
[0025] Otherwise, execute the steps of sending the page loading request to the server through the first thread and sending the initialization information to the server through the second thread.
[0026] Preferably, after storing or caching the current page to a preset set of visited pages, the method further comprises:
[0027] Monitoring the cache duration of the visited pages included in the visited page set;
[0028] When a target visited page whose cache duration reaches a preset first duration threshold appears in the visited page set, the target visited page is deleted.
[0029] Preferably, the page loading method further comprises: maintaining a corresponding task feature identifier for each of the preloading tasks, and maintaining a corresponding block feature identifier for each of the page initialization blocks;
[0030] The generating of the page loading request and the initialization information corresponding to the page loading request includes:
[0031] Determine target task feature identifiers of multiple preloading tasks corresponding to the page to be loaded and target block feature identifiers of multiple page initialization blocks corresponding to the page to be loaded;
[0032] The plurality of target task feature identifiers are encapsulated as a page loading request, and the plurality of target block feature identifiers are encapsulated as initialization information.
[0033] In a second aspect, an embodiment of the present invention provides a client, including: a generation unit, a transmission unit and a page processing unit, wherein:
[0034] The generating unit is configured to generate a page loading request and initialization information corresponding to the page loading request in response to receiving a page loading trigger;
[0035] The transmission unit is used to send the page loading request generated by the generation unit to the server through a first thread, and send the initialization information generated by the generation unit to the server through a second thread; and receive the network data corresponding to the page loading request sent by the server through the first thread, and receive the page initialization architecture corresponding to the initialization information through the second thread;
[0036] The page processing unit is used to render the page initialization framework using the network data.
[0037] Preferably, the client further comprises: a maintenance unit, wherein:
[0038] The maintenance unit is used to maintain a plurality of preloading tasks for a page, and to maintain a plurality of page initialization blocks and associations between the plurality of page initialization blocks and the plurality of preloading tasks, wherein each of the page initialization blocks is a part of the page initialization architecture;
[0039] The page processing unit is used to render a page initialization block associated with the network data portion using the network data portion when the first thread receives any one or more network data portions of the preloaded task and the second thread receives any one or more page initialization blocks.
[0040] Preferably,
[0041] When the page loading trigger indicates switching from the current page to the next page,
[0042] The page processing unit is further used to determine whether the next page has a target page initialization block inherited from the current page. If so, the next page directly inherits the target page initialization block and uses the network data portion associated with the target page initialization block to render the target page initialization block.
[0043] An embodiment of the above invention has the following advantages or beneficial effects: since a page loading request is sent to a server through a first thread, and initialization information is sent to the server through a second thread, and the first thread and the second thread can independently perform transmission tasks without affecting each other, that is, the first thread receives network data corresponding to the page loading request sent by the server, and the second thread receives a page initialization framework corresponding to the initialization information, the total duration of page loading is the duration of the first thread receiving the network data corresponding to the page loading request sent by the server, and the duration of the second thread receiving the page initialization framework corresponding to the initialization information, the longer time plus the time of rendering the page initialization framework using network data. Since the network data and the page initialization framework can be transmitted simultaneously, the page loading time can be effectively shortened.
[0044] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0046] Figure 1 is a schematic diagram of the main process of the page loading method according to an embodiment of the present invention;
[0047] Figure 2 is a schematic diagram of the main process of a page loading method according to another embodiment of the present invention;
[0048] Figure 3 is a schematic diagram of the main process of a page loading method according to another embodiment of the present invention;
[0049] Figure 4is a schematic diagram of the main process of generating a page loading request and initialization information according to an embodiment of the present invention;
[0050] Figure 5 is a schematic diagram of main units of a client according to an embodiment of the present invention;
[0051] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0052] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0054] Figure 1 is a page loading method according to an embodiment of the present invention. Figure 1 As shown, the page loading method may include the following steps:
[0055] 101: In response to a trigger of page loading, generate a page loading request and initialization information corresponding to the page loading request;
[0056] 102: Send a page loading request to the server through the first thread, and send initialization information to the server through the second thread;
[0057] 103: When the first thread receives network data corresponding to the page loading request sent by the server, and the second thread receives the page initialization framework corresponding to the initialization information, the page initialization framework is rendered using the network data.
[0058] Among them, initialization information refers to information related to the page architecture, such as control structure information in the page, control location information, division location information of each area in the page, architecture information of each area, etc., so as to obtain the corresponding controls, architecture of each area, etc. according to this information to form the page initialization architecture.
[0059] Network data refers to text, pictures and other data from the server that fills the initialization structure of the page.
[0060] Among them, the functions or uses of the first thread and the second thread can be pre-set so that the first thread can send a page loading request to the server and receive network data corresponding to the page loading request sent by the server; so that the second thread can send initialization information to the server and receive the page initialization architecture corresponding to the initialization information sent by the server.
[0061] The trigger of page loading refers to receiving an external click on a page or application or receiving a specific gesture, etc. For example, the page loading can be triggered by the user clicking on the application to start, or by the user instructing the application to start through a specific gesture, or by the user clicking on a control or hyperlink in the application to enter the next page.
[0062] Wherein, the first thread and the second thread are independent of each other, so that the process of sending the page loading request and the initialization information can be performed synchronously, and the process of the first thread receiving the network data corresponding to the page loading request sent by the server and the process of the second thread receiving the page initialization framework corresponding to the initialization information can be performed synchronously, then, the total time length of the first thread receiving the network data corresponding to the page loading request sent by the server and the second thread receiving the page initialization framework corresponding to the initialization information can be max(t1, t2), that is, the maximum value of t1 and t2; wherein t1 represents the time length required from generating the page loading request and the initialization information corresponding to the page loading request to the first thread receiving the network data corresponding to the page loading request sent by the server, and t2 represents the time length required from generating the page loading request and the initialization information corresponding to the page loading request to the second thread receiving the page initialization framework corresponding to the initialization information. Then, the total time length required for page loading is max(t1, t2)+t3, wherein t3 represents the time length required for rendering the page initialization framework using network data.
[0063] Therefore, in Figure 1 In the illustrated embodiment, since a page loading request is sent to the server through a first thread and initialization information is sent to the server through a second thread, the first thread and the second thread can independently perform transmission tasks without affecting each other, that is, the first thread receives network data corresponding to the page loading request sent by the server, and the second thread receives a page initialization framework corresponding to the initialization information. Then, the total duration of the page loading is the duration of the first thread receiving the network data corresponding to the page loading request sent by the server and the duration of the second thread receiving the page initialization framework corresponding to the initialization information, the longer duration plus the duration of rendering the page initialization framework using the network data. Since the network data and the page initialization framework can be transmitted simultaneously, the page loading time can be effectively shortened.
[0064] It is worth noting that the above-mentioned page loading method can provide a thread class interface (Iworker) for the first thread and the second thread, so as to provide a page loading refresh method through the thread class interface (Iworker) and return whether the refresh is successful, and a data loading method and return whether the loading is successful.
[0065] It is worth noting that the second thread can be the main thread, and the first thread can be the second ready-made sub-thread. In addition, the main thread can also directly initialize the page architecture corresponding to the initialization information. When the initialization fails, the initialization information is sent to the server through the second thread, so that the locally stored page architecture can be obtained first. When it is not stored locally, it is obtained from the server, which can further improve the page loading efficiency.
[0066] In addition, the first thread and the second thread can be monitored to timely obtain the status of the first thread and the second thread processing. For example, by monitoring, it is timely known whether the first thread has received the network data corresponding to the page loading request sent by the server and whether the second thread has received the page initialization architecture corresponding to the initialization information.
[0067] In one embodiment of the present invention, the page loading method may further include: when the first thread receives network data corresponding to the page loading request sent by the server, and the second thread does not receive the page initialization framework corresponding to the initialization information, the network data is stored or cached; when the second thread receives the page initialization framework corresponding to the initialization information, the page initialization framework is rendered using the stored or cached network data. That is, when the network data is received earlier than the page initialization framework is received, the network data is first stored or cached to wait for the page initialization framework, which can effectively ensure the accuracy of page loading.
[0068] In one embodiment of the present invention, the page loading method may further include: maintaining a plurality of preloading tasks for the page, maintaining a plurality of page initialization blocks and associations between the plurality of page initialization blocks and the plurality of preloading tasks, wherein each page initialization block is a part of the page initialization architecture; accordingly,
[0069] The first thread receives network data corresponding to the page loading request sent by the server, including: the first thread receives network data parts of any one or more preloading tasks;
[0070] The second thread receives a page initialization framework corresponding to the initialization information, including: the second thread receives any one or more page initialization blocks;
[0071] The rendering page initialization architecture includes: using the network data part to render the page initialization block associated with the network data part.
[0072] The network data portion refers to a portion of all network data required for loading a web page. One network data portion corresponds to one page initialization block and can be used to render one page initialization block.
[0073] Through the above process, it is achieved to divide the web page into multiple page initialization blocks and multiple network data parts, and the coupling between each network data part and each page initialization block is released, so that each network data part can be transmitted according to a certain queue such as first come first served, and transmitted in the first thread, and each page initialization block can be transmitted in the second thread.
[0074] In addition, through the above process, the page initialization blocks can be rendered one by one without waiting until all network data is received before rendering, which can effectively shorten the rendering time, thereby effectively improving the page loading efficiency and reducing the probability of blank pages.
[0075] In addition, compared with the transmission of network data for the entire page and the page initialization architecture for the entire page, or even compared with the transmission of network data for multiple pages and the page initialization architecture for multiple pages, the size of the above-mentioned network data portion is significantly smaller than the network data for the entire page or the network data for multiple pages, and the size of the above-mentioned page initialization block is significantly smaller than the page initialization architecture for the entire page or the page initialization architecture for multiple pages. Transmission through the network data portions and the page initialization blocks can effectively reduce network overhead and the consumption of resources of the device, thereby effectively improving transmission efficiency, that is, it can shorten the above-mentioned t1 and t2, thereby further shortening the page loading time.
[0076] In one embodiment of the present invention, Figure 2 As shown, the page loading method may further include:
[0077] 201: When the page loading trigger indicates switching from the current page to the next page, determine whether the next page has a target page initialization block inherited from the current page. If yes, execute step 202; otherwise, execute step 204;
[0078] 202: directly inheriting the target page initialization block, and using the network data portion associated with the target page initialization block to render the target page initialization block;
[0079] 203: Generate a page loading request for the next page and generate corresponding initialization information for other page initialization blocks in the next page, and end the current process;
[0080] 204: Execute the step of generating a page loading request and initialization information corresponding to the page loading request.
[0081] Among them, switching from the current page to the next page can be in the shopping application or client, after entering the homepage of the shopping application, the user clicks or touches any control button or hyperlink (such as a control for submitting an order, a home appliance link, a hyperlink established through a picture, etc.), that is, the shopping application or client receives a page loading trigger instruction to switch from the current page to the next page. For example, if there is a page initialization block that is a fixed item category list display area, and the data displayed in the item category list display area is different, the item category list display area corresponding to the next page can directly inherit the item category list display area corresponding to the current page, and the network data in the item category list display area corresponding to the next page needs to be obtained from the server.
[0082] It is worth noting that after the above step 203, based on generating a page loading request for the next page and generating corresponding initialization information for other page initialization blocks in the next page, the first thread continues to execute to receive the network data part of any one or more preloading tasks; the second thread receives any one or more page initialization blocks and uses the network data part to render the page initialization block associated with the network data part.
[0083] Through the above process, the page initialization block is inherited to avoid repeated acquisition from the server, which can further shorten the initialization time of the page initialization block.
[0084] In one embodiment of the present invention, Figure 3 As shown, the above page loading method may further include the following steps:
[0085] 301: Cache the current page to the preset set of visited pages;
[0086] 302: Determine whether there is a target page matching the page loading request and the initialization information in the accessed page set. If yes, execute step 303; otherwise, execute step 304;
[0087] 303: Load the target page and end the current process;
[0088] 304: Execute the steps of sending a page loading request to the server through the first thread and sending initialization information to the server through the second thread.
[0089] Pages that have been visited can be cached or stored. When loading pages that have been visited, they can be loaded directly from the stored or cached collection of visited pages, which can effectively improve page loading efficiency.
[0090] In one embodiment of the present invention, after storing or caching the current page to a preset visited page set, it may further include: monitoring the cache duration of the visited pages included in the visited page set; when a target visited page appears in the visited page set whose cache duration reaches a preset first duration threshold, deleting the target visited page.
[0091] The above process can prevent the visited pages from excessively occupying device memory or storage, so as to effectively improve the operating efficiency of the device executing the page loading method, thereby effectively improving the page loading efficiency.
[0092] The first duration threshold may be set according to user requirements or a device implementing the page loading method. For example, the cache duration of the visited pages included in the visited page set generally does not exceed 24 hours.
[0093] In one embodiment of the present invention, Figure 4 As shown, the page loading method may further include:
[0094] 401: maintaining a corresponding task feature identifier for each preloading task, and maintaining a corresponding block feature identifier for each page initialization block;
[0095] 402: Determine target task feature identifiers of multiple preloading tasks corresponding to the page to be loaded and target block feature identifiers of multiple page initialization blocks corresponding to the page to be loaded;
[0096] 403: Encapsulate multiple target task feature identifiers into a page loading request, and encapsulate multiple target block feature identifiers into initialization information.
[0097] The task feature identifier may include the feature identifier of the corresponding page and the ID of the preloaded task in the corresponding page, and its structure may be "feature identifier of the page - ID of the preloaded task", so that the corresponding page and the preloaded task in the page can be clearly expressed through the task feature identifier. Accordingly, the block feature identifier of the page initialization block is obtained by converting the feature identifier of the page corresponding to the page initialization block and the relative position of the page initialization block in the corresponding page, that is, a corresponding coordinate system can be established for the page, and the coordinates of the center points of each page initialization block are determined, and the feature identifier of the page corresponding to the page initialization block and the center point coordinate combination are used as the feature identifier of the page initialization block.
[0098] By encapsulating multiple target task feature identifiers into a page loading request and encapsulating multiple target block feature identifiers into initialization information, the page loading request and the initialization information can express the target of the page loading more clearly and accurately.
[0099] The above embodiments can be applied to Android applications.
[0100] In addition, for Android applications, the above thread class interface (Iworker) can be implemented by customizing Runnable.
[0101] In addition, for Android applications, a data state abstract class (StateBase) can be set. The data state abstract class (StateBase) internally holds the above-mentioned custom Runnable class instance, which can expose refresh data and implement data monitoring.
[0102] In addition, for Android applications, data status is monitored through the data status implementation class, which includes the data request state class (StateLoading), data return completion state (StateDone), data destroyed state (StateDestroyed), and data being listened state (StateListening).
[0103] In addition, for Android applications, the task feature identifier of the preload task can be maintained through the singleton thread pool class, and multiple preload tasks can be set. Each preload task corresponds to a unique task feature identifier. At the same time, it supports monitoring data status, refreshing data rendering, and resource release functions.
[0104] In addition, each method operation of the thread pool class is encapsulated through the data request and management callback class (functional core class).
[0105] like Figure 5 As shown, an embodiment of the present invention provides a client 500, which includes: a generation unit 501, a transmission unit 502 and a page processing unit 503, wherein:
[0106] A generating unit 501, configured to generate a page loading request and initialization information corresponding to the page loading request in response to receiving a page loading trigger;
[0107] The transmission unit 502 is used to send the page loading request generated by the generation unit 501 to the server through the first thread, and send the initialization information generated by the generation unit 501 to the server through the second thread; and receive the network data corresponding to the page loading request sent by the server through the first thread, and receive the page initialization architecture corresponding to the initialization information through the second thread;
[0108] The page processing unit 503 is used to render the page initialization framework using the network data when the transmission unit 502 receives the network data corresponding to the page loading request sent by the server through the first thread and receives the page initialization framework corresponding to the initialization information through the second thread.
[0109] In one embodiment of the present invention, the page processing unit 503 is further used to store or cache the network data when the first thread receives network data corresponding to the page loading request sent by the server and the second thread does not receive the page initialization framework corresponding to the initialization information; when the second thread receives the page initialization framework corresponding to the initialization information, use the stored or cached network data to render the page initialization framework.
[0110] In one embodiment of the present invention, Figure 5 As shown, the client 500 further includes: a maintenance unit 504, wherein:
[0111] A maintenance unit 504 is used to maintain a plurality of preloading tasks for a page, and to maintain a plurality of page initialization blocks and associations between the plurality of page initialization blocks and the plurality of preloading tasks, wherein each page initialization block is a part of a page initialization architecture;
[0112] The page processing unit 503 is used to render the page initialization block associated with the network data portion using the network data portion when the first thread receives any one or more network data portions of the preloaded tasks and the second thread receives any one or more page initialization blocks.
[0113] In one embodiment of the present invention, when the page loading trigger indicates switching from the current page to the next page,
[0114] The page processing unit is further used to determine whether the next page has a target page initialization block inherited from the current page. If so, it directly inherits the target page initialization block and uses the network data part associated with the target page initialization block to render the target page initialization block.
[0115] In one embodiment of the present invention, the page processing unit 503 is further configured to cache the current page into a preset set of visited pages;
[0116] The page processing unit 503 is further used to determine whether there is a target page matching the page loading request and the initialization information in the accessed page set, and if so, load the target page; otherwise, trigger the transmission unit 502;
[0117] The transmission unit 502 is further used to execute the steps of sending a page loading request to the server through the first thread and sending initialization information to the server through the second thread when receiving the trigger of the page processing unit 503.
[0118] In one embodiment of the present invention, the transmission unit 502 is further configured to monitor the cache duration of the visited pages included in the visited page set;
[0119] The page processing unit 503 is further configured to delete a target visited page when a target visited page whose cache duration reaches a preset first duration threshold appears in the visited page set.
[0120] In one embodiment of the present invention, the maintenance unit 504 is further used to maintain a corresponding task feature identifier for each preload task, and maintain a corresponding block feature identifier for each page initialization block;
[0121] The generation unit 501 is used to determine the target task feature identifiers of multiple preloading tasks corresponding to the page to be loaded and the target block feature identifiers of multiple page initialization blocks corresponding to the page to be loaded; encapsulate the multiple target task feature identifiers into a page loading request, and encapsulate the multiple target block feature identifiers into initialization information.
[0122] Figure 6 An exemplary system architecture 600 of a client to which the page loading method according to an embodiment of the present invention can be applied or which implements the page loading method is shown.
[0123] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0124] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0125] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0126] The server 605 may be a server that provides various services, such as a background management server (only an example) that supports shopping websites browsed by users using the terminal devices 601, 602, and 603. The background management server may analyze and process the received page loading request and the initialization information corresponding to the page loading request, and feed back the processing result (such as network data, page initialization architecture - only an example) to the terminal device.
[0127] It should be noted that the page loading method provided in the embodiment of the present invention is generally executed by the terminal devices 601 , 602 , 603 , and accordingly, the client that implements the page loading method is generally set in the terminal devices 601 , 602 , 603 .
[0128] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0129] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0130] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0131] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0132] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0133] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The units involved in the embodiments of the present invention may be implemented in software or hardware. The units described may also be provided in a processor, for example, may be described as: a processor including a generation unit, a transmission unit, and a page processing unit. The names of these units do not, in some cases, constitute limitations on the units themselves, for example, the generation unit may also be described as "in response to receiving a page loading trigger, generating a page loading request and initialization information corresponding to the page loading request".
[0136] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: in response to receiving a page loading trigger, generating a page loading request and initialization information corresponding to the page loading request; sending the page loading request to the server through the first thread, and sending the initialization information to the server through the second thread; when the first thread receives the network data corresponding to the page loading request sent by the server, and the second thread receives the page initialization framework corresponding to the initialization information, the network data is used to render the page initialization framework.
[0137] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the device includes: when the first thread receives network data corresponding to the page loading request sent by the server, and the second thread does not receive the page initialization framework corresponding to the initialization information, the network data is stored or cached; when the second thread receives the page initialization framework corresponding to the initialization information, the page initialization framework is rendered using the stored or cached network data.
[0138] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the device includes: maintaining multiple preloading tasks for the page, and maintaining multiple page initialization blocks and the association relationship between the multiple page initialization blocks and the multiple preloading tasks, wherein each page initialization block is a part of the page initialization architecture; the first thread receives the network data part of any one or more preloading tasks; the second thread receives any one or more page initialization blocks; and using the network data part, rendering the page initialization block that has an association relationship with the network data part.
[0139] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the device includes: caching the current page to a preset visited page set; determining whether there is a target page matching the page loading request and initialization information in the visited page set, and if so, loading the target page; otherwise, executing the steps of sending a page loading request to a server through a first thread and sending initialization information to the server through a second thread.
[0140] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the device includes: monitoring the cache duration of the visited pages included in the visited page set; when a target visited page appears in the visited page set whose cache duration reaches a preset first duration threshold, deleting the target visited page.
[0141] According to the technical solution of an embodiment of the present invention, since a page loading request is sent to a server through a first thread, and initialization information is sent to the server through a second thread, and the first thread and the second thread can independently perform transmission tasks without affecting each other, that is, the first thread receives network data corresponding to the page loading request sent by the server, and the second thread receives a page initialization framework corresponding to the initialization information, the total duration of page loading is the duration of the first thread receiving the network data corresponding to the page loading request sent by the server and the duration of the second thread receiving the page initialization framework corresponding to the initialization information, the longer time plus the time for rendering the page initialization framework using network data. Since the network data and the page initialization framework can be transmitted simultaneously, the page loading time can be effectively shortened.
[0142] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A page loading method, characterized in that: include: In response to a trigger of page loading, generating a page loading request and initialization information corresponding to the page loading request; Sending the page loading request to the server through a first thread, and sending the initialization information to the server through a second thread; When the first thread receives network data corresponding to the page loading request sent by the server, and the second thread receives a page initialization framework corresponding to the initialization information, the network data is used to render the page initialization framework; Further comprising: maintaining a plurality of preloading tasks for a page, and maintaining a plurality of page initialization blocks and associations between the plurality of page initialization blocks and the plurality of preloading tasks, wherein each of the page initialization blocks is a part of the page initialization architecture; The first thread receives network data corresponding to the page loading request sent by the server, including: the first thread receives any one or more network data parts of the preloading task; The second thread receives the page initialization structure corresponding to the initialization information, including: the second thread receives any one or more of the page initialization blocks.
2. The page loading method according to claim 1, characterized in that: Further including: When the first thread receives network data corresponding to the page loading request sent by the server, and the second thread does not receive the page initialization framework corresponding to the initialization information, the network data is stored or cached; When the second thread receives the page initialization framework corresponding to the initialization information, the page initialization framework is rendered using the stored or cached network data.
3. The page loading method according to claim 1 or 2, characterized in that: Rendering the page initialization framework includes: using the network data portion to render a page initialization block associated with the network data portion.
4. The page loading method according to claim 3, characterized in that: Further including: When the page loading trigger indicates switching from the current page to the next page, It is determined whether the next page has a target page initialization block inherited from the current page. If so, the target page initialization block is directly inherited, and the network data portion associated with the target page initialization block is used to render the target page initialization block.
5. The page loading method according to claim 4, characterized in that: Further comprising: caching the current page into a preset set of visited pages; After generating the page loading request and the initialization information corresponding to the page loading request, the method further includes: Determine whether there is a target page matching the page loading request and the initialization information in the visited page set, If yes, then load the target page; Otherwise, execute the steps of sending the page loading request to the server through the first thread and sending the initialization information to the server through the second thread.
6. The page loading method according to claim 4, characterized in that: After storing or caching the current page to a preset visited page set, the method further includes: Monitoring the cache duration of the visited pages included in the visited page set; When a target visited page whose cache duration reaches a preset first duration threshold appears in the visited page set, the target visited page is deleted.
7. The page loading method according to claim 3, characterized in that: Further including: Maintaining a corresponding task feature identifier for each of the preloading tasks, and maintaining a corresponding block feature identifier for each of the page initialization blocks; The generating of the page loading request and the initialization information corresponding to the page loading request includes: Determine target task feature identifiers of multiple preloading tasks corresponding to the page to be loaded and target block feature identifiers of multiple page initialization blocks corresponding to the page to be loaded; The plurality of target task feature identifiers are encapsulated as a page loading request, and the plurality of target block feature identifiers are encapsulated as initialization information.
8. A client, characterized in that: include: A generation unit, a transmission unit and a page processing unit, wherein: The generating unit is configured to generate a page loading request and initialization information corresponding to the page loading request in response to receiving a page loading trigger; The transmission unit is used to send the page loading request generated by the generation unit to the server through a first thread, and send the initialization information generated by the generation unit to the server through a second thread; and receive the network data corresponding to the page loading request sent by the server through the first thread, and receive the page initialization architecture corresponding to the initialization information through the second thread; The page processing unit is used to render the page initialization framework using the network data; The client further comprises: a maintenance unit, wherein: The maintenance unit is used to maintain a plurality of preloading tasks for a page, and to maintain a plurality of page initialization blocks and associations between the plurality of page initialization blocks and the plurality of preloading tasks, wherein each of the page initialization blocks is a part of the page initialization architecture; The transmission unit is further configured to receive any one or more network data parts of the preloading task through the first thread; and receive any one or more page initialization blocks through the second thread.
9. The client according to claim 8, characterized in that: The page processing unit is used to render a page initialization block associated with the network data portion using the network data portion when the first thread receives any one or more network data portions of the preloaded task and the second thread receives any one or more page initialization blocks.
10. The client according to claim 9, characterized in that: When the page loading trigger indicates switching from the current page to the next page, The page processing unit is further used to determine whether the next page has a target page initialization block inherited from the current page. If so, the next page directly inherits the target page initialization block and uses the network data portion associated with the target page initialization block to render the target page initialization block.
11. A page loading electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
