Page rendering method and device, electronic equipment and computer readable medium
By determining the paths of the target page's static page files and local static resource files, and using file path retrieval methods to obtain static resources, the problems of excessive network requests and abnormal path resolution in existing technologies are solved, thus improving page rendering efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2023-06-21
- Publication Date
- 2026-04-14
AI Technical Summary
In existing technologies, the method of intercepting network resource requests to construct a request response and return static page files cannot reduce the number of network requests. Furthermore, the mismatch between the file directory structure and the resource access path leads to abnormal path resolution, failure to find static page files, and low page rendering efficiency.
By responding to access requests, the static page files of the target page and the paths of its local static resource files are determined. Static resources are obtained by retrieving file paths, avoiding network connections and ensuring accurate retrieval of static resources, thereby enabling efficient page rendering.
This reduces the number of network requests, avoids static page file lookup failures, and improves page rendering efficiency.
Smart Images

Figure CN116861112B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of this disclosure relate to the field of computer technology, and more particularly to page rendering methods, apparatus, electronic devices, and computer-readable media. Background Technology
[0002] Currently, page rendering is a technology that outputs visual results based on the various page resources corresponding to web page links. The common approach to page rendering is to intercept network resource requests, construct a request-response mechanism, and return the static page file to achieve page rendering.
[0003] However, the inventors discovered that when rendering pages using the above method, the following technical problems often occur:
[0004] First, the methods of actively intercepting network resource requests for pages and constructing request responses to return static page files require establishing a network connection, which cannot achieve the goal of reducing the number of network requests.
[0005] Secondly, when locating static page files, due to the mismatch between the file directory structure and the resource access path, path resolution errors often occur, resulting in failure to find static page files and low page rendering efficiency.
[0006] The information disclosed in this background section is only intended to enhance the understanding of the background of the inventive concept, and therefore may contain information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0007] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0008] Some embodiments of this disclosure provide page rendering methods, apparatuses, electronic devices, and computer-readable media to address the technical problems mentioned in the background section above.
[0009] In a first aspect, some embodiments of this disclosure provide a page rendering method, including: in response to receiving an access request for a target page, determining a corresponding static page file based on the page address of the target page; in response to determining that the resource acquisition method is a file path acquisition method, determining a local static resource file path corresponding to the static page file; acquiring the static resources required by the static page file based on the local static resource file path; and performing page rendering for the target page based on the static resources and the static page file.
[0010] Optionally, determining the local static resource file path corresponding to the static page file includes: determining the resource link of the static resource required by the static page file; and modifying the resource link to the local static resource file path.
[0011] Optionally, determining the resource links of the static resources required for the static page file includes: scanning the file content of the static page file to obtain static resource association information in the file content; and generating resource links for the static resource association information as resource links of the static resources.
[0012] Optionally, the above-mentioned scanning of the file content of the static page file to obtain the static resource association information in the file content includes: converting the text content into target format text; filtering candidate static resource information paragraphs from the target format text through target matching to obtain a set of candidate static resource information paragraphs; for each candidate static resource information paragraph in the set of candidate static resource information paragraphs, determining candidate static resource information paragraphs in the target format text that have a paragraph proximity relationship with the candidate static resource information paragraphs, as adjacent static resource information paragraphs, to obtain a group of adjacent static resource information paragraphs; adding the adjacent static resource information paragraphs in the obtained group of adjacent static resource information paragraphs as candidate static resource information paragraphs to the set of candidate static resource information paragraphs to obtain a set of static resource information paragraphs after addition; performing paragraph deduplication on the set of static resource information paragraphs after addition to obtain a set of deduplicated static resource information paragraphs; inputting each deduplicated static resource information paragraph in the set of deduplicated static resource information paragraphs into a static resource information recognition model to output static resource recognition information to obtain a set of static resource recognition information as static resource association information.
[0013] Optionally, before determining the local static resource file path corresponding to the static page file in response to determining that the resource acquisition method is a file path acquisition method, the method further includes: obtaining local memory usage information; generating resource acquisition method configuration information based on the local memory usage information; and determining the resource acquisition method from the resource acquisition method configuration information in response to determining that the resource acquisition method configuration information has not been adjusted.
[0014] Optionally, after performing page rendering for the target page based on the static resources and the static page file, the method further includes: in response to determining that the page rendering speed of the target page is less than a predetermined rendering speed, adjusting the resource acquisition method configuration information to a network request acquisition method; and performing page rendering for the target page based on the network request acquisition method and the static page file.
[0015] Optionally, after performing page rendering for the target page based on the network request acquisition method and the static page file, the method further includes: in response to determining that the page rendering speed for the network request acquisition method is less than the predetermined rendering speed, adjusting the resource acquisition method configuration information to a parallel acquisition method, wherein the parallel acquisition method indicates that static resources are acquired in parallel using the network request acquisition method and the file path acquisition method; in response to determining that the resource acquisition method configuration information is a parallel acquisition method, determining static resource allocation share information; and performing page rendering for the target page using the parallel acquisition method based on the static resource allocation share information.
[0016] Secondly, some embodiments of this disclosure provide a page rendering apparatus, including: a first determining unit configured to determine a corresponding static page file based on the page address of the target page in response to receiving an access request for a target page; a second determining unit configured to determine a local static resource file path corresponding to the static page file in response to determining that the resource acquisition method is a file path acquisition method; an acquisition unit configured to acquire the static resources required by the static page file based on the local static resource file path; and an execution unit configured to perform page rendering for the target page based on the static resources and the static page file.
[0017] Optionally, the second determining unit can be configured to: determine the resource links of the static resources required by the aforementioned static page file; and modify the aforementioned resource links to the aforementioned local static resource file paths.
[0018] Optionally, the second determining unit can be configured to: scan the file content of the aforementioned static page file to obtain static resource association information in the file content; and generate resource links for the aforementioned static resource association information as resource links for the aforementioned static resources.
[0019] Optionally, the second determining unit can be configured to: convert the aforementioned text content into target format text; filter candidate static resource information paragraphs from the target format text using a target matching method to obtain a candidate static resource information paragraph set; for each candidate static resource information paragraph in the candidate static resource information paragraph set, determine candidate static resource information paragraphs in the target format text that have a paragraph proximity relationship with the aforementioned candidate static resource information paragraphs, and obtain a proximity static resource information paragraph group; add the proximity static resource information paragraphs in the obtained proximity static resource information paragraph group set as candidate static resource information paragraphs to the aforementioned candidate static resource information paragraph set to obtain an added static resource information paragraph set; perform paragraph deduplication on the added static resource information paragraph set to obtain a deduplicated static resource information paragraph set; input each deduplicated static resource information paragraph in the deduplicated static resource information paragraph set to a static resource information recognition model to output static resource recognition information, and obtain a static resource recognition information set as static resource association information.
[0020] Optionally, the above apparatus further includes: acquiring local memory usage information; generating resource acquisition method configuration information based on the local memory usage information; and determining the resource acquisition method from the resource acquisition method configuration information in response to determining that the resource acquisition method configuration information has not been adjusted.
[0021] Optionally, the apparatus further includes: in response to determining that the page rendering speed of the target page is less than a predetermined rendering speed, adjusting the resource acquisition method configuration information to a network request acquisition method; and performing page rendering for the target page according to the network request acquisition method and the static page file.
[0022] Optionally, the apparatus further includes: in response to determining that the page rendering speed for the network request acquisition method is less than the predetermined rendering speed, adjusting the resource acquisition method configuration information to a parallel acquisition method, wherein the parallel acquisition method represents acquiring static resources in parallel using the network request acquisition method and the file path acquisition method; in response to determining that the resource acquisition method configuration information is a parallel acquisition method, determining static resource allocation share information; and performing page rendering for the target page using the parallel acquisition method based on the static resource allocation share information.
[0023] Thirdly, some embodiments of this disclosure provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, such that when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any implementation of the first aspect.
[0024] Fourthly, some embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method as described in any implementation of the first aspect.
[0025] Fifthly, some embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
[0026] The above embodiments of this disclosure have the following beneficial effects: the page rendering efficiency of the target page is improved through the page rendering methods of some embodiments of this disclosure. Specifically, the reasons for the low page rendering efficiency are: first, the method of actively intercepting network resource requests of the page and constructing a request response to return a static page file requires establishing a network connection, which cannot achieve the goal of reducing the number of network requests; second, when locating the static page file, due to the mismatch between the file directory structure and the resource access path, path resolution errors often occur, and the static page file search fails, resulting in low page rendering efficiency. Based on this, the page rendering method of some embodiments of this disclosure firstly, in response to receiving an access request for the target page, determines the corresponding static page file according to the page address of the target page, for use in subsequent target page rendering and determination of static resource file paths. Then, in response to determining that the resource acquisition method is a file path acquisition method, determines the local static resource file path corresponding to the static page file, for use in subsequent acquisition of required static resources. Furthermore, based on the local static resource file path, the static resources required by the static page file can be accurately obtained, avoiding the problem of static page file search failure, thereby indirectly improving the rendering efficiency of subsequent pages. Finally, based on the aforementioned static resources and static page files, page rendering for the target page can be performed efficiently. In summary, obtaining static resources through local static resource file paths not only eliminates the need for network connections, reducing the number of network requests, but also avoids the problem of static page file lookup failures. This indirectly improves page rendering efficiency. Attached Figure Description
[0027] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.
[0028] Figure 1 This is a schematic diagram illustrating an application scenario of a page rendering method according to some embodiments of the present disclosure;
[0029] Figure 2This is a flowchart of some embodiments of the page rendering method according to this disclosure;
[0030] Figure 3 These are flowcharts of other embodiments of the page rendering method according to this disclosure;
[0031] Figure 4 This is a schematic diagram of static resource allocation in some embodiments of the page rendering method according to this disclosure;
[0032] Figure 5 This is a schematic diagram of the structure of some embodiments of the page rendering apparatus according to the present disclosure;
[0033] Figure 6 This is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. Detailed Implementation
[0034] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0035] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0036] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0037] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0038] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0039] Before performing any operations related to the collection, storage, or use of resource information (such as static resources) involved in this disclosure, the relevant organizations or individuals shall fulfill their obligations, including conducting resource information security impact assessments, informing resource information subjects, and obtaining prior authorization and consent from resource information subjects.
[0040] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0041] Figure 1 This is a schematic diagram of an application scenario of a page rendering method according to some embodiments of the present disclosure.
[0042] exist Figure 1 In this application scenario, firstly, in response to receiving an access request for target page 102, electronic device 101 can determine the corresponding static page file 104 based on the page address 103 of target page 102. In this application scenario, target page 102 can be a "shopping page". Page address 103 can be "http: / / www.****.com / ". Static page file 104 can be an .html file. Then, in response to determining that the resource acquisition method is a file path acquisition method, electronic device 101 can determine the local static resource file path 105 corresponding to the static page file 104. In this application scenario, local static resource file path 105 can be "c: / xxx / a.txt". Furthermore, electronic device 101 can obtain the static resources 106 required by the static page file 104 based on the local static resource file path 105. Finally, based on the static resources 106 and the static page file 104, page rendering for target page 102 is performed.
[0043] It should be noted that the aforementioned electronic device 101 can be either hardware or software. When the electronic device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device. When the electronic device is software, it can be installed in the hardware devices listed above. It can be implemented as, for example, multiple software programs or software modules used to provide distributed services, or as a single software program or software module. No specific limitations are made here.
[0044] It should be understood that Figure 1 The number of electronic devices shown is merely illustrative. Any number of electronic devices can be used depending on the implementation requirements.
[0045] Continue to refer to Figure 2 The diagram illustrates a flow 200 of some embodiments of a page rendering method according to the present disclosure. This page rendering method includes the following steps:
[0046] Step 201: In response to receiving an access request for the target page, determine the corresponding static page file based on the page address of the target page.
[0047] In some embodiments, in response to receiving an access request for a target page, the execution body of the page rendering method (e.g., based on the page address of the target page) is... Figure 1 The electronic device 101 shown can determine the corresponding static page file based on the page address of the target page. The target page can be a page to be rendered on the target client. The access request can be a request sent by the target client to access the target page. The page address (URL, UniformResourceLocator) can be the access address of the target page. The static page file can be a HyperText Markup Language (HTML) file. Static page files are files with the extension ".html" or ".htm" and can be opened using Notepad and web page editing software.
[0048] As an example, the aforementioned executing entity can use an offline static page file list to determine the file information of the corresponding static page file based on the page address of the target page. The offline static page file list represents the association between the file information of the static page file and its page address.
[0049] Step 202: In response to determining that the resource acquisition method is the file path acquisition method, determine the local static resource file path corresponding to the above static page file.
[0050] In some embodiments, in response to determining that the resource acquisition method is a file path acquisition method, the executing entity may determine the local static resource file path corresponding to the static page file. The resource acquisition method can be the method for acquiring the static resources required by the page. The file path acquisition method can be the method of acquiring static resources through a local static resource file path. The local static resource file path can be the local path where the executing entity stores the static page file.
[0051] As an example, in response to determining that the resource acquisition method is file path acquisition, the aforementioned execution entity can determine the local static resource file path corresponding to the aforementioned static page file by querying the resource path.
[0052] As an example, in response to determining that the file information of the corresponding static page file exists in the list of offline static page files, the resource acquisition method is determined to be the file path acquisition method.
[0053] In some optional implementations of certain embodiments, the execution entity determining the local static resource file path corresponding to the static page file may include the following steps:
[0054] The first step is to determine the resource links of the static resources required by the static page files mentioned above.
[0055] The resource link represents the source of a static resource. A resource link can be obtained by concatenating a file protocol, file storage path, and other parameters. The file protocol and other parameters can be dynamically set according to the business scenario. For example, the resource link could be "http: / / www.****.com / s / 142JXNvEDK1w3lXQ_AA".
[0056] In practice, static resources include, but are not limited to, at least one of the following: image resources and audio resources. Corresponding resource links include, but are not limited to, at least one of the following: image resource links and audio resource links.
[0057] The second step is to change the above resource link to the path of the local static resource file.
[0058] As an example, the aforementioned execution entity can modify the resource link to the local static resource file path by editing the text.
[0059] Optionally, the execution entity may determine the resource links of the static resources required by the static page file by including the following steps:
[0060] The first step is to scan the contents of the aforementioned static page files to obtain the static resource association information within those files. This static resource association information can be any information associated with a static resource. In practice, it may include: static resource path information and static resource quantity information.
[0061] As an example, firstly, the aforementioned execution entity can input the file content into a character recognition model to output static resource location information within the file content. Then, based on this static resource location information, the execution entity can generate static resource association information through resource calculation or resource querying.
[0062] The second step is to generate resource links for the aforementioned static resource association information, which will then serve as resource links for the static resources.
[0063] As an example, the aforementioned execution entity can select the file storage path from static resource association information. Then, the execution entity can generate resource links by concatenating the file storage path, file protocol, and other parameters.
[0064] Optionally, the above-mentioned scanning of the file content of the static page file to obtain static resource association information in the file content includes:
[0065] The first step is to convert the above text content into the target format text.
[0066] The target format text can be text with a predefined format. For example, the predefined format can be Word format.
[0067] The second step is to filter candidate static resource information paragraphs from the target format text using target matching, thus obtaining a set of candidate static resource information paragraphs. The target matching method can be regular expression matching.
[0068] The third step is to identify, for each candidate static resource information paragraph in the above candidate static resource information paragraph set, the candidate static resource information paragraphs in the above target format text that have a paragraph proximity relationship with the above candidate static resource information paragraphs, and then take them as adjacent static resource information paragraphs to obtain the adjacent static resource information paragraph group.
[0069] The fourth step is to take the adjacent static resource information paragraphs in the obtained adjacent static resource information paragraph group set as candidate static resource information paragraphs and add them to the above candidate static resource information paragraph set to obtain the added static resource information paragraph set.
[0070] The fifth step is to deduplicate the static resource information paragraph set after the addition of paragraphs, and obtain the deduplicated static resource information paragraph set.
[0071] Step 6: Input each deduplicated static resource information segment from the deduplicated static resource information segment set into the static resource information recognition model to output static resource recognition information, thus obtaining a static resource recognition information set as static resource association information. The static resource information recognition model can be a model that identifies resource information associated with static resources. This resource information can include, but is not limited to, at least one of the following: static resource path information, static resource quantity information. In practice, the static resource information recognition model can be a text recognition model. For example, the text recognition model can be a CNN (Convolutional Neural Network) + Seq2Seq (Sequence to Sequence) model + Attention model.
[0072] In some optional implementations of certain embodiments, prior to step 202, the method further includes:
[0073] The first step is to obtain local memory usage information.
[0074] The local memory usage information can be the percentage of memory used by the executing entity to perform each task. Local memory usage information can be a value between 0 and 100. For example, local memory usage information could be "52%".
[0075] The second step is to generate resource acquisition method configuration information based on the aforementioned local memory usage information. This resource acquisition method configuration information can be for static resources.
[0076] As an example, in response to determining that local memory usage is less than a predetermined percentage, the configuration information for obtaining static resources via file path will be determined as the resource acquisition method configuration information. In response to determining that local memory usage is greater than or equal to a predetermined percentage, the configuration information for obtaining static resources via network request will be determined as the resource acquisition method configuration information.
[0077] The third step is to determine the resource acquisition method configuration information from the above resource acquisition method configuration information in response to the determination that the above resource acquisition method configuration information has not been adjusted.
[0078] Among them, the configuration information of resource acquisition methods can be adjusted by relevant personnel to achieve dynamic adjustment of resource acquisition methods.
[0079] Step 203: Obtain the static resources required by the above-mentioned static page file based on the local static resource file path.
[0080] In some embodiments, the aforementioned executing entity may obtain the static resources required by the aforementioned static page file based on the aforementioned local static resource file path.
[0081] Step 204: Based on the above static resources and the above static page files, perform page rendering for the above target page.
[0082] In some embodiments, the execution entity may perform page rendering for the target page based on the static resources and the static page files.
[0083] As an example, the aforementioned execution entity can send static page files to the target client, so that the target client can call static resources based on the static page files and the local static resource file paths.
[0084] The above embodiments of this disclosure have the following beneficial effects: the page rendering efficiency of the target page is improved through the page rendering methods of some embodiments of this disclosure. Specifically, the reasons for the low page rendering efficiency are: first, the method of actively intercepting network resource requests of the page and constructing a request response to return a static page file requires establishing a network connection, which cannot achieve the goal of reducing the number of network requests; second, when locating the static page file, due to the mismatch between the file directory structure and the resource access path, path resolution errors often occur, and the static page file search fails, resulting in low page rendering efficiency. Based on this, the page rendering method of some embodiments of this disclosure firstly, in response to receiving an access request for the target page, determines the corresponding static page file according to the page address of the target page, for use in subsequent target page rendering and determination of static resource file paths. Then, in response to determining that the resource acquisition method is a file path acquisition method, determines the local static resource file path corresponding to the static page file, for use in subsequent acquisition of required static resources. Furthermore, based on the local static resource file path, the static resources required by the static page file can be accurately obtained, avoiding the problem of static page file search failure, thereby indirectly improving the rendering efficiency of subsequent pages. Finally, based on the aforementioned static resources and static page files, page rendering for the target page can be performed efficiently. In summary, obtaining static resources through local static resource file paths not only eliminates the need for network connections, reducing the number of network requests, but also avoids the problem of static page file lookup failures. This indirectly improves page rendering efficiency.
[0085] Further reference Figure 3 The diagram illustrates a flow 300 of another embodiment of a page rendering method according to the present disclosure. This page rendering method includes the following steps:
[0086] Step 301: In response to receiving an access request for the target page, determine the corresponding static page file based on the page address of the target page.
[0087] Step 302: In response to determining that the resource acquisition method is the file path acquisition method, determine the local static resource file path corresponding to the above static page file.
[0088] Step 303: Obtain the static resources required by the above-mentioned static page file based on the above-mentioned local static resource file path.
[0089] Step 304: Based on the above static resources and the above static page files, perform page rendering for the above target page.
[0090] In some embodiments, the specific implementation of steps 301-304 and the resulting technical effects can be found in [reference needed]. Figure 2 Steps 201-204 in the corresponding embodiments will not be repeated here.
[0091] Step 305: In response to determining that the page rendering speed of the target page is less than the predetermined rendering speed, adjust the resource acquisition method configuration information to network request acquisition method.
[0092] In some embodiments, in response to determining that the page rendering speed of the target page is less than a predetermined rendering speed, the execution entity (e.g., Figure 1 The electronic device 101 shown can adjust the above resource acquisition method configuration information to a network request acquisition method. The predetermined rendering speed can be a pre-set value.
[0093] Step 306: Based on the above network request acquisition method and the above static page file, perform page rendering for the above target page.
[0094] In some embodiments, the execution entity may perform page rendering for the target page based on the network request acquisition method and the static page file.
[0095] As an example, firstly, the aforementioned executing entity can receive network resource requests sent by the target client via a network connection. Then, the executing entity can send static page files and static resources as a response to the target client via the network connection.
[0096] In some optional implementations of certain embodiments, after step 306, the method further includes:
[0097] The first step is to adjust the resource acquisition method configuration information to a parallel acquisition method in response to the determination that the page rendering speed for the aforementioned network request acquisition method is less than the predetermined rendering speed. Here, the parallel acquisition method indicates that static resources are acquired in parallel using both the aforementioned network request acquisition method and the aforementioned file path acquisition method.
[0098] The second step, in response to determining that the resource acquisition method configuration information is a parallel acquisition method, is to determine the static resource allocation share information. This static resource allocation share information can represent the resource proportion of static resources acquired through network request acquisition and the resource proportion of static resources acquired through file path acquisition. The resource proportion can be the ratio between the size of the static resources acquired through the resource acquisition method and the total size of the static resources. For example, the static resource allocation share information could be {"Network request acquisition method": 30%", "File path acquisition method": 70%}.
[0099] As an example, the aforementioned executing entity can treat the received, manually input resource allocation share information as static resource allocation share information.
[0100] See Figure 4 In response to determining that the above resource acquisition method configuration information is a parallel acquisition method, the executing entity can divide the static resource 401 into static sub-resources 403 corresponding to the network request acquisition method and static sub-resources 404 corresponding to the file path acquisition method through the static resource allocation share information 402. The static resource allocation share information 402 can be {"Network request acquisition method": 30%", "File path acquisition method": 70%}.
[0101] The third step is to perform page rendering for the target page based on the static resource allocation information and the parallel acquisition method described above.
[0102] from Figure 3 It can be seen from this that, with Figure 2 Compared to the description of some corresponding embodiments, Figure 3 In some corresponding embodiments, the page rendering method process 300, when using the file path acquisition method to execute the page rendering of the target page, is limited by the slow rendering speed. By switching the resource acquisition method to execute the page rendering of the target page, the page rendering efficiency can be improved.
[0103] Further reference Figure 5 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of a page rendering apparatus, which are similar to... Figure 2 Corresponding to the method embodiments shown, this page rendering apparatus can be specifically applied to various electronic devices.
[0104] like Figure 5 As shown, a page rendering apparatus 500 includes: a first determining unit 501, a second determining unit 502, an acquiring unit 503, and an execution unit 504. The first determining unit 501 is configured to, in response to receiving an access request for a target page, determine the corresponding static page file based on the page address of the target page; the second determining unit 502 is configured to, in response to determining that the resource acquisition method is a file path acquisition method, determine the local static resource file path corresponding to the static page file; the acquiring unit 503 is configured to, based on the local static resource file path, acquire the static resources required by the static page file; and the execution unit 504 is configured to, based on the static resources and the static page file, perform page rendering for the target page.
[0105] In some optional implementations of some embodiments, the first determining unit 501 in the page rendering apparatus 500 may be further configured to: determine the resource link of the static resource required by the static page file; and modify the resource link to the path of the local static resource file.
[0106] In some optional implementations of some embodiments, the first determining unit 501 in the page rendering apparatus 500 may be further configured to: scan the file content of the static page file to obtain static resource association information in the file content; and generate resource links for the static resource association information as resource links for the static resources.
[0107] In some optional implementations of certain embodiments, the first determining unit 501 in the page rendering apparatus 500 may be further configured to: convert the text content into target format text; filter candidate static resource information paragraphs from the target format text using a target matching method to obtain a set of candidate static resource information paragraphs; for each candidate static resource information paragraph in the set of candidate static resource information paragraphs, determine candidate static resource information paragraphs in the target format text that have a paragraph proximity relationship with the candidate static resource information paragraphs, and obtain a group of adjacent static resource information paragraphs; add the adjacent static resource information paragraphs in the obtained group of adjacent static resource information paragraphs as candidate static resource information paragraphs to the set of candidate static resource information paragraphs to obtain a set of static resource information paragraphs after addition; perform paragraph deduplication on the set of static resource information paragraphs after addition to obtain a set of deduplicated static resource information paragraphs; input each deduplicated static resource information paragraph in the set of deduplicated static resource information paragraphs to a static resource information recognition model to output static resource recognition information to obtain a set of static resource recognition information as static resource association information.
[0108] In some optional implementations of certain embodiments, the page rendering apparatus 500 further includes: an information acquisition unit, an information generation unit, and an acquisition method determination unit (not shown in the figure). The information acquisition unit can be configured to: acquire local memory usage information; the information generation unit can be configured to: generate resource acquisition method configuration information based on the local memory usage information; and the acquisition method determination unit can be configured to: determine the resource acquisition method from the resource acquisition method configuration information in response to determining that the resource acquisition method configuration information has not been adjusted.
[0109] In some optional implementations of certain embodiments, the page rendering apparatus 500 further includes a first adjustment unit and a first rendering execution unit (not shown in the figure). The first adjustment unit may be configured to: adjust the resource acquisition method configuration information to a network request acquisition method in response to determining that the page rendering speed of the target page is less than a predetermined rendering speed; the first rendering execution unit may be configured to: perform page rendering for the target page according to the network request acquisition method and the static page file.
[0110] In some optional implementations of certain embodiments, the page rendering apparatus 500 further includes: a second adjustment unit, a third determination unit, and a second rendering execution unit (not shown in the figure). The second adjustment unit may be configured to: adjust the resource acquisition method configuration information to a parallel acquisition method in response to determining that the page rendering speed for the network request acquisition method is less than the predetermined rendering speed; wherein the parallel acquisition method represents the use of the network request acquisition method and the file path acquisition method to acquire static resources in parallel; the third determination unit may be configured to: determine static resource allocation share information in response to determining that the resource acquisition method configuration information is a parallel acquisition method; the second rendering execution unit may be configured to perform page rendering for the target page based on the static resource allocation share information and using the parallel acquisition method.
[0111] It is understandable that the units described in the page rendering device 500 are related to the reference Figure 2 The steps in the described method correspond to each other. Therefore, the operations, features, and beneficial effects described above for the method also apply to the page rendering device 500 and the units contained therein, and will not be repeated here.
[0112] The following is for reference. Figure 6 It illustrates electronic devices suitable for implementing some embodiments of this disclosure (e.g., Figure 1 A schematic diagram of the structure of electronic device 101)600 in the middle. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.
[0113] like Figure 6As shown, the electronic device 600 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory 602 or a program loaded from a storage device 608 into a random access memory 603. The random access memory 603 also stores various programs and data required for the operation of the electronic device 600. The processing unit 601, the read-only memory 602, and the random access memory 603 are interconnected via a bus 604. An input / output interface 605 is also connected to the bus 604.
[0114] Typically, the following devices can be connected to the input / output interface 605: input devices 606 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 608 including, for example, magnetic tape, hard disk, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 6 Each box shown can represent a device or multiple devices as needed.
[0115] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a read-only memory 602. When the computer program is executed by the processing device 601, it performs the functions defined above in the methods of some embodiments of this disclosure.
[0116] It should be noted that, in some embodiments of this disclosure, the computer-readable medium described above may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In some embodiments of this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0117] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0118] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: in response to receiving an access request for a target page, determine the corresponding static page file based on the page address of the target page; in response to determining that the resource acquisition method is a file path acquisition method, determine the local static resource file path corresponding to the static page file; acquire the static resources required by the static page file based on the local static resource file path; and perform page rendering for the target page based on the static resources and the static page file.
[0119] Computer program code for performing operations of some embodiments of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0120] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0121] The units described in some embodiments of this disclosure can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a first determining unit, a second determining unit, an acquiring unit, and an execution unit. The names of these units do not necessarily limit the unit itself; for example, the acquiring unit may also be described as "a unit that acquires the static resources required by the aforementioned static page file based on the aforementioned local static resource file path."
[0122] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0123] Some embodiments of this disclosure also provide a computer program product, including a computer program that, when executed by a processor, implements any of the page rendering methods described above.
[0124] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. A page rendering method, comprising: In response to receiving an access request for a target page, the corresponding static page file is determined based on the page address of the target page by using an offline static page file list, wherein the offline static page file list represents the association between the file information and the page address of the static page file; In response to determining that the resource acquisition method is a file path acquisition method, the local static resource file path corresponding to the static page file is determined, wherein the local static resource file path is obtained by modifying the text of the resource links of the static resources required by the static page file; Based on the local static resource file path, obtain the static resources required for the static page file, wherein the process of obtaining the static resources does not require establishing a network connection; Based on the static resources and the static page files, perform page rendering for the target page.
2. The method according to claim 1, wherein, Determining the local static resource file path corresponding to the static page file includes: Determine the resource links of the static resources required by the static page file; Change the resource link to the path of the local static resource file.
3. The method according to claim 2, wherein, The step of determining the resource links of the static resources required by the static page file includes: Scan the file content of the static page file to obtain the static resource association information in the file content; Generate resource links for the static resource association information, and use them as resource links for the static resources.
4. The method according to claim 3, wherein, The step of scanning the file content of the static page file to obtain static resource association information in the file content includes: Convert the file content into the target format text; Candidate static resource information paragraphs are selected from the target format text using target matching to obtain a set of candidate static resource information paragraphs; For each candidate static resource information paragraph in the candidate static resource information paragraph set, determine the candidate static resource information paragraphs in the target format text that have a paragraph proximity relationship with the candidate static resource information paragraphs, and obtain the adjacent static resource information paragraph group; The adjacent static resource information paragraphs in the obtained adjacent static resource information paragraph group set are taken as candidate static resource information paragraphs and added to the candidate static resource information paragraph set to obtain the static resource information paragraph set after addition. The static resource information paragraph set after the addition is deduplicated to obtain the deduplicated static resource information paragraph set. Each deduplicated static resource information segment in the deduplicated static resource information segment set is input into the static resource information recognition model to output static resource recognition information, thereby obtaining a static resource recognition information set, which serves as static resource association information.
5. The method according to claim 1, wherein, Before determining the local static resource file path corresponding to the static page file in response to determining that the resource acquisition method is a file path acquisition method, the method further includes: Get local memory usage information; Based on the local memory usage information, resource acquisition method configuration information is generated; In response to determining that the resource acquisition method configuration information has not been adjusted, the resource acquisition method is determined from the resource acquisition method configuration information.
6. The method according to claim 5, wherein, After performing page rendering for the target page based on the static resources and the static page file, the method further includes: In response to determining that the page rendering speed of the target page is less than the predetermined rendering speed, the resource acquisition method configuration information is adjusted to network request acquisition method; Based on the network request acquisition method and the static page file, perform page rendering for the target page.
7. The method according to claim 6, wherein, After performing page rendering for the target page based on the network request acquisition method and the static page file, the method further includes: In response to determining that the page rendering speed for the network request acquisition method is less than the predetermined rendering speed, the resource acquisition method configuration information is adjusted to a parallel acquisition method, wherein the parallel acquisition method indicates that static resources are acquired in parallel using the network request acquisition method and the file path acquisition method; In response to determining that the resource acquisition method configuration information is a parallel acquisition method, the static resource allocation share information is determined; Based on the static resource allocation share information, page rendering for the target page is performed using the parallel acquisition method.
8. A page rendering apparatus, comprising: The first determining unit is configured to, in response to receiving an access request for a target page, determine the corresponding static page file based on the page address of the target page by using an offline static page file list, wherein the offline static page file list represents the association between the file information and the page address of the static page file; The second determining unit is configured to determine the local static resource file path corresponding to the static page file in response to determining that the resource acquisition method is a file path acquisition method, wherein the local static resource file path is obtained by modifying the text of the resource links of the static resources required by the static page file; The acquisition unit is configured to acquire the static resources required by the static page file based on the local static resource file path, wherein the acquisition process of the static resources does not require the establishment of a network connection. The execution unit is configured to perform page rendering for the target page based on the static resources and the static page file.
9. An electronic device, comprising: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.
11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-7.
Citation Information
Patent Citations
Method and terminal for improving page acquisition efficiency
CN114422491A