Applet page rendering method and device, electronic equipment and storage medium
By registering synchronization signals in the operating system and using vertical synchronization signals to trigger the rendering engine to render the mini-program page, the problem of low rendering efficiency caused by JavaScript cross-thread communication is solved, and more efficient page rendering is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2022-08-11
- Publication Date
- 2026-07-10
AI Technical Summary
In the current process of rendering mini-program pages, JavaScript, a just-in-time compiled programming language, requires multiple cross-thread communications, resulting in low page rendering efficiency and blocking the invocation of view node creation instructions.
By registering synchronization signals in the operating system, the vertical synchronization signal is used to trigger the rendering engine to render the mini-program page, reducing cross-thread communication calls, accurately controlling the timing of rendering command sending, and directly controlling the sending of batch rendering commands by the native module.
It improves the rendering efficiency of mini-program pages, reduces cross-thread communication blocking, ensures accurate sending of rendering commands, and enhances overall rendering performance.
Smart Images

Figure CN115328597B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to page rendering methods, apparatuses, electronic devices, and storage media for applets in the field of image processing. Background Technology
[0002] Currently, mini-programs are applications that can be used without downloading or installing. Mini-program pages typically use native rendering engines. However, just-in-time compiled programming languages (JavaScript, or JS for short) require multiple instruction calls at runtime, which occupies the entire cross-thread communication path for a long time, blocking the subsequent call communication of view node creation instructions and affecting the page rendering progress of mini-programs. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for rendering pages in a mini-program.
[0004] According to one aspect of this disclosure, a method for rendering a page of a mini-program is provided. The method may include: acquiring a synchronization signal triggered by the operating system, wherein the synchronization signal is pre-registered in the operating system's interface and is used to trigger a rendering engine to render the mini-program's page; in response to the triggered synchronization signal, determining that a view node of the mini-program has changed, and sending a rendering instruction to the rendering engine, wherein the view node represents the mini-program's native view, and the rendering instruction causes the rendering engine to render and display the rendering content of the native view corresponding to the changed view node on the operating system's display screen, thereby obtaining the mini-program's page.
[0005] According to another aspect of this disclosure, another method for rendering pages of a mini-program is also provided. This method includes: the native system acquiring a synchronization signal triggered by the operating system, wherein the synchronization signal is pre-registered in the operating system's interface and used to trigger the rendering engine to render the mini-program's page; the native system, in response to the triggered synchronization signal, determining that a view node of the mini-program has changed, and sending a rendering instruction to the rendering engine, wherein the view node represents the mini-program's native view; and the rendering engine, in response to the rendering instruction, rendering and displaying the rendering content of the native view corresponding to the changed view node on the operating system's display screen, thereby obtaining the mini-program's page.
[0006] According to another aspect of this disclosure, an operating system for a mini-program is also provided. This system may include: a native system, configured to acquire a synchronization signal triggered by the operating system, wherein the synchronization signal is pre-registered in the operating system's interface and is used to trigger a rendering engine to render the mini-program's page; in response to the triggered synchronization signal, determining that a view node of the mini-program has changed, and sending a rendering instruction to the rendering engine, wherein the view node represents the mini-program's native view; and a rendering engine, configured to, in response to the rendering instruction, render and display the rendering content of the native view corresponding to the changed view node on the operating system's display screen, thereby obtaining the mini-program's page.
[0007] According to one aspect of this disclosure, a page rendering apparatus for a mini-program is also provided. The apparatus may include: an acquisition unit, configured to acquire a synchronization signal triggered by an operating system, wherein the synchronization signal is pre-registered in the operating system and is used to trigger a rendering engine to render the page of the mini-program, and the synchronization signal is pre-registered in the interface of the operating system; and a first sending unit, configured to, in response to the triggered synchronization signal, determine that a view node of the mini-program has changed, and send a rendering instruction to the rendering engine, wherein the view node represents the native view of the mini-program, and the rendering instruction causes the rendering engine to render and display the rendering content of the native view corresponding to the changed view node on the display screen corresponding to the operating system, thereby obtaining the page of the mini-program.
[0008] According to one aspect of this disclosure, an electronic device is also provided. The electronic device may include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute the page rendering method of the applet according to embodiments of this disclosure.
[0009] According to another aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to cause a computer to execute a page rendering method of an applet according to an embodiment of this disclosure.
[0010] According to another aspect of this disclosure, a computer program product is also provided, which may include a computer program that, when executed by a processor, implements the page rendering method of the applet according to the embodiments of this disclosure.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0013] Figure 1 This is a flowchart of a page rendering method for a mini-program according to an embodiment of the present disclosure;
[0014] Figure 2(a) is a flowchart of another page rendering method for a mini-program according to an embodiment of the present disclosure;
[0015] Figure 2(b) is a flowchart of another page rendering method for a mini-program according to an embodiment of the present disclosure;
[0016] Figure 3 It is a flowchart created based on a page from a related technology;
[0017] Figure 4 This is a flowchart of a screen rendering method according to an embodiment of the present disclosure;
[0018] Figure 5 This is a schematic diagram of an operating system for a mini-program according to an embodiment of the present disclosure;
[0019] Figure 6 This is a schematic diagram of a page rendering apparatus for a mini-program according to an embodiment of the present disclosure;
[0020] Figure 7 This is a schematic diagram of another page rendering apparatus for a mini-program according to an embodiment of the present disclosure;
[0021] Figure 8 This is a block diagram of an electronic device for a page rendering method of a mini-program according to an embodiment of the present disclosure. Detailed Implementation
[0022] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0023] First, the applicable interpretations of some nouns or terms appearing in the description of the embodiments of this application are as follows:
[0024] Batch rendering is a method to improve the overall efficiency of the rendering pipeline by reducing the number of rendering commands sent by the central processing unit.
[0025] Mini programs are applications that can be used without downloading or installing, and they adopt a runtime architecture that physically isolates the logic layer and the rendering layer.
[0026] A native rendering engine is a functional module implemented in native code on the operating system that can be used to render pages.
[0027] Native modules are functional modules implemented in native code on the operating system. They can serve as a bridge for communication between the just-in-time (JIT) compiled programming language layer and the native rendering engine, and can forward the rendering assignments of the JIT compiled programming language layer to the rendering engine.
[0028] The page rendering method provided in this application, as a processing method for page rendering, can be applied to application scenarios on device screens with mini-programs installed. It should be noted that the application scenarios can also be applied to scenarios such as image rendering on AR / VR devices, and are not limited thereto.
[0029] Figure 1 This is a flowchart of a page rendering method for a mini-program according to an embodiment of the present disclosure. Figure 1 The mini-program to be rendered shown runs on an operating system. As an optional implementation, the operating system may include at least a native system and a rendering engine. The native system may be a native module for forwarding rendering instructions to the rendering engine, and the rendering engine may be a native view rendering engine for rendering the page. The page rendering method of the mini-program may be applied to the native system.
[0030] like Figure 1 As shown, the implementation scheme of the page rendering method of this mini-program can include at least the following implementation steps:
[0031] Step S102: Obtain the synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the interface of the operating system and is used to trigger the rendering engine to render the applet's page.
[0032] In the technical solution provided by step S102 disclosed in this application, if the operating system detects that the corresponding synchronization signal has been triggered, it can read the pre-registered synchronization signal from the interface of the operating system. It should be noted that the operating system involved by the inventor can be an operating system such as Android, and no specific limitation is made on the type of operating system here. The synchronization signal can be used to trigger the rendering engine to render the page of the applet, for example, it can be a vertical synchronization (vsync) signal.
[0033] In one alternative approach, the native module can register the vertical synchronization signal callback with the operating system. For example, the native module can access the operating system's interface to call the corresponding registration method of the operating system, thereby completing the process of registering the synchronization signal with the operating system's interface. This allows the operating system to periodically trigger the registered vertical synchronization signal callback, enabling the native module to obtain the synchronization signal triggered by the operating system.
[0034] It should be noted that in the above embodiments of this application, the rendering (refreshing) process of the obtained mini-program page can be a row refresh or a horizontal refresh (Horizontal Scanning), for example, it can be a refresh from left to right; it can also be a screen refresh or a vertical refresh (Vertical Scanning), for example, it can be a refresh from top to bottom. That is, in the embodiments of this disclosure, no specific limitation is made on the type of synchronization signal. For example, the horizontal synchronization signal issued in response to the horizontal refresh behavior should also be within the protection scope of the embodiments of this disclosure.
[0035] It should be further noted that the vertical synchronization signal mentioned in the above embodiments can refer to the signal issued after vertical refresh. For example, during the vertical refresh process when the page to be rendered is completed, if the entire screen is vertically refreshed, that is, after a vertical refresh cycle is completed, there will be a short blank period. If the refresh process is detected to have entered the blank period, the operating system can be triggered to issue a vertical synchronization signal at this moment and pre-register it in the operating system's interface to facilitate the transmission and acquisition of the synchronization signal.
[0036] As can be seen from the above, in this embodiment of the disclosure, the operating system provides an interface or application programming interface (API) for registering synchronization signal callbacks in order to obtain synchronization signals triggered by the operating system.
[0037] Step S104: In response to the triggered synchronization signal, it is determined that the view node of the mini program has changed, and a rendering instruction is sent to the rendering engine. The view node is used to represent the native view of the mini program, and the rendering instruction is used to make the rendering engine render the rendering content of the native view corresponding to the changed view node and display it on the screen corresponding to the operating system to obtain the page of the mini program.
[0038] In the technical solution provided by step S104 of this application, after obtaining the synchronization signal triggered by the operating system, it can be determined whether the view node of the mini-program has changed in response to the triggering of the synchronization signal. For example, if the JS layer calls the node creation capability to create a node, it can be determined that the view node of the mini-program has changed. If the view node of the mini-program has changed, a rendering instruction can be sent to the rendering engine. In response to the triggered rendering instruction, the rendering content of the native view corresponding to the view node of the mini-program is rendered and displayed, and its rendering content is displayed on the display screen corresponding to the operating system to obtain the page of the mini-program. The view node can be a native view node, which can be used to represent the components in the native view of the mini-program. For example, a page can correspond to a view tree, and there are multiple view nodes (view tree nodes) in the view tree. Each button or text label on the page of the mini-program can be a view node. The rendering instruction can be used to characterize the instruction to render the page. For example, it can be a batch rendering instruction (batchRender), which can exist in the native view rendering engine.
[0039] In one alternative approach, the native module can determine whether the view node has been changed. If the view node has been changed, the native module can call the batch rendering command in the native view rendering engine. The native view rendering engine responds to the batch rendering command, lays out the native view node, and finally renders the content on the display screen.
[0040] It should be noted that changes to view nodes can be either creating or updating view nodes. The node changes described here are for illustrative purposes only and do not impose specific restrictions on the types of changes that can occur to view nodes.
[0041] In related technologies, the creation and rendering of a mini-program's pages are typically driven by a just-in-time (JIT) compiled programming language runtime, which drives the native system. This process involves a JavaScript thread sending a view node creation instruction to the native view rendering engine via a cross-thread approach, followed by a batch rendering instruction. The native view rendering engine then lays out and positions the view nodes, ultimately displaying the rendered content on the screen. However, this process requires at least two cross-thread instruction calls from the JavaScript thread to the native thread, which consumes a significant amount of time in the cross-thread communication path, blocking subsequent view node creation instruction calls and thus affecting rendering performance. In contrast, this embodiment utilizes synchronization signals, allowing the native module to directly control the timing of batch rendering instruction transmission, simplifying the batch rendering instruction transmission process and thereby improving rendering efficiency.
[0042] Through steps S102 to S104, a synchronization signal triggered by the operating system is obtained. This synchronization signal is pre-registered in the operating system's interface and is used to trigger the rendering engine to render the mini-program's page. Based on the synchronization signal trigger, a change in the mini-program's view node is determined, and a rendering instruction is sent to the rendering engine. The view node represents the mini-program's native view, and the rendering instruction instructs the rendering engine to render and display the content of the native view corresponding to the changed view node on the operating system's display screen, thus obtaining the mini-program's page. In other words, in this embodiment, triggering the rendering engine to render the mini-program's page using a synchronization signal reduces cross-thread communication calls and makes the timing of rendering instruction sending more accurate, achieving the technical effect of improving page rendering efficiency and solving the technical problem of low page rendering efficiency.
[0043] The method described in this embodiment will now be described in further detail.
[0044] As an optional embodiment, step S104, obtaining a synchronization signal triggered by the operating system, includes: in response to the completion of the display refresh, obtaining a synchronization signal triggered by the operating system.
[0045] In this embodiment, after the view on the display screen is refreshed, in response to the signal indicating that the display screen refresh is complete, the operating system can trigger a callback of the synchronization signal. In response to the issued synchronization information, the callback of the registered synchronization signal is invoked to trigger the next display screen rendering.
[0046] As can be seen from the above, after the view node is updated, the timing of sending batch rendering commands can be controlled by the native module using the synchronization signal. This allows for more accurate rendering of the display screen after the screen refresh is completed, making the rendering timing more precise and avoiding the problem of JavaScript frequently sending rendering commands during runtime. This achieves the technical effect of improving rendering efficiency and solves the technical problem of poor rendering efficiency.
[0047] As an optional embodiment, in response to the completion of the display refresh, acquiring the synchronization signal triggered by the operating system includes: in response to the completion of the display refresh according to a time period, acquiring the synchronization signal triggered by the operating system according to a time period.
[0048] In this embodiment, when the display screen completes its refresh according to a time cycle, the operating system can send a synchronization signal according to the time cycle, and the synchronization signal triggered by the operating system according to the time cycle can be obtained.
[0049] In one alternative, after a vertical refresh cycle of the entire display screen is completed, there will be a brief blank period during which the operating system can trigger a synchronization signal according to the time period.
[0050] As an optional embodiment, in response to the completion of the display screen refresh according to the time period, obtaining the synchronization signal triggered by the operating system according to the time period includes: in response to the completion of the vertical refresh of the display screen according to the time period, obtaining the vertical synchronization signal triggered by the operating system according to the time period, wherein the synchronization signal includes a vertical synchronization signal.
[0051] In this embodiment, after the display screen completes vertical refresh according to the time period, in response to the completion of the display screen refresh according to the time period, a synchronization signal triggered by the operating system according to the time period can be obtained, wherein the time period can be the refresh period, for example, the vertical refresh period; the synchronization signal can include a vertical synchronization signal.
[0052] In one alternative, a callback for a vertical synchronization signal can be registered with the operating system. When the display completes a refresh cycle, it sends a vertical synchronization signal, and the operating system responds to the sent vertical synchronization information by calling the registered callback to trigger the next screen rendering.
[0053] In one alternative, the vertical synchronization signal can enable the central processing unit (CPU) and the graphics processing unit (GPU) to operate at the same frequency. The CPU can be responsible for updating the view of the app, while the GPU can be responsible for rendering the interface. Whenever the GPU completes vertical refresh according to the time period (completes one frame of rendering), the operating system can send a vertical synchronization signal to notify the CPU to start the next rendering process.
[0054] As an optional implementation, in response to successfully acquiring a synchronization signal, it is determined whether the view node has changed.
[0055] In this embodiment, when the synchronization signal is triggered, it can be determined whether the view node has changed in response to the successfully acquired synchronization signal.
[0056] In one alternative approach, a synchronization signal from the operating system can be acquired. In response to successfully acquiring the synchronization signal, it can be determined whether the view node has changed, thereby determining whether to proceed with the next rendering operation.
[0057] As an optional embodiment, determining whether a view node of a mini-program has changed includes: determining that a view node has changed in response to creating or updating a view node.
[0058] In this embodiment, a synchronization signal issued by the operating system can be obtained. In response to the successfully obtained synchronization signal, it can be determined whether the view node has changed. When it is determined that a view node has been created or updated, it can be determined that the view node has been changed.
[0059] For example, the command to create a view can be forwarded to the native view rendering engine through the native module. In response to the command to create a view, the native view rendering engine creates a real native view node, thereby completing the creation of the node and obtaining the synchronization signal issued by the operating system. In response to the successfully obtained synchronization signal, it is determined whether the view node has changed. When it is determined that there is a view node creation behavior, it can be determined that the view node has changed.
[0060] In related technologies, the layout calculation and display rendering of native views are all performed at the native rendering system layer. JavaScript runtime cannot perceive the current working state of the native rendering system, and the timing control of sending rendering commands is not accurate enough. This may result in frequent sending of rendering commands, causing cross-thread communication blockage and thus affecting rendering performance. However, the embodiments of this disclosure determine whether to render the view of the mini-program by determining whether the view node has changed, thereby achieving the goal of improving the efficiency of rendering the screen of the mini-program.
[0061] As an optional embodiment, step S104 includes: sending a view creation instruction to the rendering engine, wherein the view creation instruction is used to cause the rendering engine to create view nodes of the applet other than the modified view nodes.
[0062] In this embodiment, after sending a rendering instruction to the rendering engine, a view creation instruction can be sent to the rendering engine again. The view creation instruction can be used to enable the rendering engine to create view nodes for the applet other than the changed view nodes.
[0063] In one alternative approach, the view can be created by calling the view creation capabilities of the native module across threads during JavaScript runtime; the native module can forward the view creation command to the native view rendering engine, which then responds to the view creation command by creating a view node other than the view node itself.
[0064] In this embodiment, a synchronization signal triggered by the operating system is obtained. This synchronization signal is pre-registered in the operating system's interface and is used to trigger the rendering engine to render the mini-program's page. Based on the synchronization signal, a change in the mini-program's view node is determined, and a rendering instruction is sent to the rendering engine. The view node represents the mini-program's native view, and the rendering instruction instructs the rendering engine to render and display the content of the native view corresponding to the changed view node on the operating system's display screen, thus obtaining the mini-program's page. In other words, in this embodiment, the rendering engine is triggered to render the mini-program's page via a synchronization signal, thereby reducing cross-thread communication calls and making the timing of rendering instruction sending more accurate. This achieves the technical effect of improving page rendering efficiency and solves the technical problem of low page rendering efficiency.
[0065] Figure 2(a) is a flowchart of another page rendering method for a mini-program according to an embodiment of the present disclosure. The mini-program to be rendered shown in Figure 2(a) runs in an operating system. As an optional implementation, the operating system may include at least a native system and a rendering engine. The page rendering method of the mini-program can be applied to the rendering engine.
[0066] As shown in Figure 2(a), the implementation scheme of the page rendering method of this mini-program can include at least the following implementation steps:
[0067] Step S202: In response to a change in the view node of the mini-program, a rendering instruction is obtained. The view node is used to represent the native view of the mini-program. The result of the view node change is determined by the native system when it obtains a synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the interface of the operating system.
[0068] In the technical solution provided by step S202 of this application, it can be determined whether the view node of the mini-program has changed. In response to the change of the view node of the mini-program, a rendering instruction is obtained. The view node can be used to represent the native view of the mini-program and can be a native view node. The result of the view node change can be determined by the native system when the native system obtains the synchronization signal triggered by the operating system. The synchronization signal can be pre-registered in the interface of the operating system and can be used to trigger the rendering engine to render the page of the mini-program. The rendering instruction can be a batch rendering instruction and can exist in the native view rendering engine.
[0069] In one alternative approach, the native module can determine whether the view node has been changed. For example, it can determine whether the view node has been created or updated. If the view node has been changed, the batch rendering function in the native view rendering engine can be invoked.
[0070] Step S204: Respond to the rendering command and render the content of the original view corresponding to the changed view node to the display screen corresponding to the operating system to obtain the page of the mini program.
[0071] In the technical solution provided in step S204 of this disclosure, in response to the rendering command, the rendering content of the original view corresponding to the changed view node can be rendered and displayed on the display screen corresponding to the operating system to obtain the page rendered by the mini program.
[0072] In one alternative approach, the native module can determine whether the view node has been changed. For example, it can determine whether the view node has been created or updated. If the view node has been changed, it can call the batch rendering command in the native view rendering engine. The native view rendering engine responds to the batch rendering command, lays out the native view node, and finally renders the content onto the display screen.
[0073] In one alternative approach, batch rendering commands can be forwarded to the native view rendering engine via a native module. In response to the batch rendering commands, the native view rendering engine lays out the native view nodes and renders the content of the native view corresponding to the changed view nodes onto the display screen of the operating system, thus obtaining the rendered page of the mini-program and completing the creation of the mini-program page.
[0074] In this embodiment of the disclosure, the optimized rendering process of the display screen can be triggered by the vertical synchronization (VSync) signal instead of sending batch rendering instructions by the JavaScript runtime. This reduces cross-thread communication calls and makes the timing of sending rendering instructions more accurate, thereby improving rendering performance.
[0075] In this embodiment, in response to a change in the view node of the mini-program, a rendering instruction is obtained. The view node represents the native view of the mini-program, and the change in the view node is determined by the native system based on a synchronization signal triggered by the operating system. This synchronization signal is pre-registered in the operating system's interface. In response to the rendering instruction, the rendering content of the native view corresponding to the changed view node is rendered and displayed on the operating system's screen, thus obtaining the mini-program's page. In other words, this embodiment triggers the rendering engine to render the mini-program's page using a synchronization signal, thereby reducing cross-thread communication calls and making the timing of rendering instruction sending more accurate. This achieves the technical effect of improving page rendering efficiency and solves the technical problem of low page rendering efficiency.
[0076] Figure 2(b) is a flowchart of another page rendering method for a mini-program according to an embodiment of the present disclosure. As shown in Figure 2(b), the implementation scheme of the page rendering method for the mini-program may include at least the following implementation steps:
[0077] In step S206, the native system obtains a synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the operating system's interface and is used to trigger the rendering engine to render the applet's page.
[0078] In the technical solution provided in step S206 of this disclosure, the synchronization signal is pre-registered in the interface of the operating system. The native system can read the synchronization signal triggered by the operating system from the interface of the operating system. The synchronization signal can be used to trigger the rendering engine to render the page of the applet.
[0079] In step S208, the native system responds to the triggered synchronization signal, determines that the view node of the mini-program has changed, and sends a rendering instruction to the rendering engine, wherein the view node is used to represent the native view of the mini-program.
[0080] In step S210, the rendering engine responds to the rendering command and renders the content of the original view corresponding to the changed view node to the display screen corresponding to the operating system, thus obtaining the page of the mini program.
[0081] In the technical solution provided by step S210 of this disclosure, a rendering command is sent to the rendering engine. The rendering engine responds to the rendering command and renders and displays the rendering content of the native view corresponding to the view node of the mini-program, and displays the rendering content on the display screen corresponding to the operating system to obtain the page of the mini-program.
[0082] Optionally, the native module can determine whether the view node has been changed. If the view node has been changed, the native module can call the batch rendering command in the native view rendering engine. The native view rendering engine responds to the batch rendering command, lays out the native view node, and finally renders the content on the display screen to obtain the page of the mini program.
[0083] Through steps S206 to S210, the native system obtains a synchronization signal triggered by the operating system. This synchronization signal is pre-registered in the operating system's interface and is used to trigger the rendering engine to render the mini-program's page. In response to the triggered synchronization signal, the native system determines that the mini-program's view node has changed and sends a rendering instruction to the rendering engine. The view node represents the mini-program's native view. In response to the rendering instruction, the rendering engine renders and displays the rendering content of the native view corresponding to the changed view node on the operating system's display screen, thus obtaining the mini-program's page. This reduces cross-thread communication calls and makes the timing of rendering instruction sending more accurate, achieving the technical effect of improving page rendering efficiency and solving the technical problem of low page rendering efficiency.
[0084] The method described in this embodiment will now be described in further detail.
[0085] As an optional implementation, the rendering engine obtains view creation instructions from the native system; in response to the view creation instructions, the rendering engine creates view nodes for the app other than the modified view nodes.
[0086] In this embodiment, after sending a rendering instruction to the rendering engine, a view creation instruction can be sent to the rendering engine again. The rendering engine receives the view creation instruction from the native system and, in response to the view creation instruction, creates a view node other than the view node.
[0087] As an optional embodiment, step S210, in response to the rendering command, renders and displays the rendering content of the original view corresponding to the changed view node on the display screen corresponding to the operating system, including: the rendering engine responds to the rendering command at regular intervals and renders and displays the rendering content on the display screen, wherein the synchronization signal is triggered by the operating system according to the time interval.
[0088] In this embodiment, the operating system can trigger a synchronization signal according to a time period. In response to the triggered synchronization signal, it sends a rendering command to the rendering engine. In response to the rendering command triggered every time period, the rendering engine renders and displays the content on the display screen. The time period can be a preset time period based on the actual situation.
[0089] In related technologies, the layout calculation and rendering of the display screen for the native view are all done at the native rendering system layer. This results in inaccurate control over the timing of sending rendering commands, leading to frequent sending of rendering commands. However, the embodiments disclosed in this disclosure can pre-set the time period for triggering the synchronization signal according to the actual situation, thereby setting the time period for page rendering according to actual needs, and thus achieving the purpose of controlling the screen rendering frequency of the mini-program.
[0090] This embodiment of the disclosure triggers the rendering engine to render the applet's page using a synchronization signal, thereby reducing cross-thread communication calls and making the timing of rendering command sending more accurate. This achieves the technical effect of improving page rendering efficiency and solves the technical problem of low page rendering efficiency.
[0091] The above technical solutions of the present disclosure will be further illustrated below with reference to preferred embodiments.
[0092] Mini Programs are applications that can be used without downloading or installing. They adopt a runtime architecture that physically separates the logic layer and the rendering layer. The content of the rendering layer can be presented through web pages (WebView) or native views (such as the native rendering engine provided by the iOS system) to meet the rendering needs of different scenarios. However, for Mini Program pages that use the native rendering engine, each page container contains a just-in-time compiled programming language (JavaScript, or JS) runtime and a native system interface.
[0093] In related technologies, the JavaScript runtime drives the native system to create and render the page. Each time, the JavaScript thread goes through the native system, sends instructions to create view nodes in a cross-thread manner, and then sends an instruction to render the display screen. The native view rendering engine then performs the layout and positioning, and finally renders the content onto the screen.
[0094] Figure 3 It is a flowchart created based on a page from a related technology, such as Figure 3 As shown, the page creation process may include:
[0095] Step S301: Invoke the view creation capability.
[0096] In this embodiment, the view can be created by the JavaScript runtime calling the native module's createView capability across threads.
[0097] Step S302: Invoke the view creation command.
[0098] In this embodiment, the native module can forward the view creation command to the native view rendering engine to complete the view creation command invocation.
[0099] Step S303: Create native view nodes.
[0100] In this embodiment, in response to a command to create a view, a true native view node can be created by the native view rendering engine.
[0101] Step S304: Invoke the batch rendering capability.
[0102] In this embodiment, the JavaScript runtime can call the batch rendering instruction in the native module across threads to achieve the purpose of calling batch capabilities.
[0103] Step S305, batch electrophoresis rendering command.
[0104] In this embodiment, batch rendering instructions can be forwarded to the native view rendering engine through the native module to complete the call to the batch rendering instructions.
[0105] Step S306: Layout and render the native view nodes.
[0106] In this embodiment, in response to a batch rendering command, the native view rendering engine lays out the native view nodes and finally renders the content to the screen, completing the creation of the mini-program page. The native view rendering engine and the native module can be two functional modules with different functions implemented by the native code on the system. The native view rendering engine can be used to render the page; the native module can be used to provide a communication bridge between the JavaScript layer and the native rendering engine, thereby enabling the forwarding of rendering specifications to the rendering engine.
[0107] In related technologies, the overall process of rendering a mini-program requires at least two cross-thread instruction calls from the JavaScript thread to the native thread, which results in poor rendering performance. Furthermore, the JavaScript runtime cannot accurately know the current working state of the native rendering engine, and its control over the timing of sending rendering instructions is not accurate enough. This may lead to frequent sending of rendering instructions, which can cause thread communication blockage and affect rendering performance.
[0108] In summary, for a single display rendering, the JavaScript runtime requires at least two cross-thread instruction calls from the JavaScript thread to the native thread, which occupies the entire cross-thread communication path for a considerable period of time, blocking subsequent view node creation instruction calls and communication, thus affecting rendering performance. For the layout calculation of the native view, the display rendering is all done at the native rendering system layer. The JavaScript runtime cannot be aware of the current working state of the native rendering system, and its control over the timing of sending rendering instructions is not accurate enough. It may send rendering instructions frequently, causing cross-thread communication to be blocked, thus affecting rendering performance.
[0109] To address the aforementioned issues, this disclosure provides a method for rendering pages in a mini-program. By using a vertical synchronization signal, after the view is updated, the vertical synchronization module triggers the native module to control the timing of sending batch rendering commands. This allows for more accurate rendering of the display screen after the screen refresh is completed, resulting in more precise control over the rendering timing. This avoids the problem of JavaScript frequently sending rendering commands during runtime, thereby improving rendering efficiency and solving the technical problem of poor rendering efficiency.
[0110] Figure 4 This is a flowchart of a screen rendering method according to an embodiment of the present disclosure, such as... Figure 4As shown in the embodiments of this disclosure, the optimized rendering process of the display screen can be triggered by the vertical synchronization (VSync) signal of the operating system instead of sending batch rendering instructions by the JavaScript runtime. This can reduce cross-thread communication calls and make the timing of rendering instruction sending more accurate, thereby improving rendering performance. The vertical synchronization can be triggered by the operating system.
[0111] In one alternative, the screen refresh process can be a horizontal scan, such as refreshing from left to right; or a vertical scan, such as refreshing from top to bottom.
[0112] In one alternative, the vertical synchronization signal can refer to vertical refresh. For example, when the entire screen has finished refreshing, that is, when a vertical refresh cycle is completed, there will be a brief blank period, at which time the vertical synchronization signal can be issued.
[0113] Step S401: Register the callback for the vertical synchronization signal.
[0114] In this embodiment, the native module can register with the system to trigger a callback of the vertical synchronization signal when the view node changes.
[0115] In one alternative approach, the corresponding operating system method can be called in the native module to register with the operating system. The system can then periodically trigger the registered vertical synchronization signal for callback, thereby achieving the purpose of receiving the callback signal. The operating system can be an operating system such as Android, and no specific restrictions are placed on the type of operating system here.
[0116] Step S402: Invoke the view creation capability.
[0117] In this embodiment, the view can be created by calling the view creation capabilities of the native module across threads during JavaScript runtime.
[0118] Step S403: Invoke the view creation command.
[0119] In this embodiment, the native module can forward the view creation command to the native view rendering engine to complete the view creation command invocation.
[0120] Step S404: Create native view nodes.
[0121] In this embodiment, the native view rendering engine can create a real native view node in response to a view creation command.
[0122] Step S405: Trigger the vertical synchronization signal to initiate a callback.
[0123] In this embodiment, the vertical synchronization signal of the native module can be triggered by the operating system to perform a callback.
[0124] In one alternative, a callback for a vertical synchronization signal can be registered with the operating system. When the display completes a refresh cycle, it sends a vertical synchronization signal, and the operating system responds to the sent vertical synchronization information by calling the registered synchronization signal to trigger the next screen rendering.
[0125] In one alternative approach, a vertical synchronization signal enables a graphics rendering technique where the central processing unit (CPU) and the graphics processing unit (GPU) operate at the same frequency. The CPU is responsible for updating the app's view, while the GPU is responsible for rendering the interface for the screen. Each time the GPU completes rendering a frame for the screen, the operating system sends a vertical synchronization signal to notify the CPU to begin the next rendering process.
[0126] Step S406: In response to a change in the view node, a batch rendering command is invoked.
[0127] In this embodiment, the native module determines whether the view node has been changed. For example, it determines whether the view node has been created or updated. If the view node has been changed, it can call the batch rendering instruction in the native view rendering engine.
[0128] In one alternative approach, a page corresponds to a view tree, and the view tree contains multiple view tree nodes. Each button or text label on the page can be a view node.
[0129] Step S407: Layout and render the native view nodes.
[0130] In this embodiment, the native view rendering engine can respond to batch rendering instructions, lay out the native view nodes, and finally render the content onto the display screen.
[0131] In this embodiment, the next rendering of the display screen is performed when the vertical synchronization signal is triggered. The timing of sending batch rendering instructions is controlled by the native module, which can more accurately control the rendering of view nodes after the screen refresh is completed, avoiding the problem of frequent sending of rendering instructions during JavaScript runtime. In the process of rendering the display screen, one instruction call across the JavaScript thread and the native thread can be reduced, thereby reducing the time spent on thread communication and enabling subsequent view node creation instructions to be sent to the native layer more quickly. This achieves the technical effect of improving the performance of the rendering display screen and solves the technical problem of poor performance of the rendering display screen.
[0132] This disclosure also provides an embodiment for performing Figure 1 The operating system of the applet shown in the embodiment Figure 5 This is a schematic diagram of an operating system for a small program according to an embodiment of the present disclosure. For example... Figure 5 As shown, the mini-program to be rendered runs in the operating system, and the mini-program's operating system 50 includes: the native system 51 and the rendering engine 52.
[0133] In one alternative, the native system 51 can be used to obtain a synchronization signal triggered by the operating system, wherein the synchronization signal is pre-registered in the interface of the operating system and is used to trigger the rendering engine to render the page of the mini-program; in response to the triggered synchronization signal, it determines that the view node of the mini-program has changed and sends a rendering instruction to the rendering engine, wherein the view node is used to represent the native view of the mini-program.
[0134] In one alternative, the rendering engine 52 can be used to respond to rendering instructions and render the content of the original view corresponding to the changed view node to the display screen corresponding to the operating system, thereby obtaining the page of the mini program.
[0135] Optionally, the rendering engine is also used to obtain view creation instructions from the native system, and in response to the view creation instructions, to create view nodes for the mini-program other than the modified view nodes.
[0136] Optionally, the rendering engine responds to rendering instructions by rendering the content of the original view corresponding to the changed view node to the display screen of the operating system through the following steps: responding to rendering instructions at regular intervals, rendering the content to the display screen, wherein the synchronization signal is triggered by the operating system according to the time interval.
[0137] In this embodiment, a synchronization signal triggered by the operating system is obtained through the native system. This synchronization signal is pre-registered in the operating system's interface and is used to trigger the rendering engine to render the mini-program's page. In response to the triggered synchronization signal, it is determined that the mini-program's view node has changed, and a rendering instruction is sent to the rendering engine. The view node represents the mini-program's native view. The rendering engine responds to the rendering instruction and renders the rendering content of the native view corresponding to the changed view node onto the operating system's display screen to obtain the mini-program's page. This achieves the technical effect of improving page rendering efficiency and solves the technical problem of poor page rendering efficiency.
[0138] This disclosure also provides an embodiment for performing Figure 1The page rendering method of the mini-program shown in the embodiment includes a page rendering device for the mini-program. The mini-program to be rendered runs in an operating system, which may include a native system and a rendering engine. The page rendering device for the mini-program can be applied to the native system.
[0139] Figure 6 This is a schematic diagram of a page rendering apparatus for a mini-program according to an embodiment of the present disclosure. Figure 6 As shown, the page rendering device 60 of the mini-program may include: an acquisition unit 61 and a first sending unit 62.
[0140] The acquisition unit 61 is used to acquire a synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the operating system and is used to trigger the rendering engine to render the page of the applet. The synchronization signal is pre-registered in the interface of the operating system.
[0141] The first sending unit 62 is used to respond to the triggering of the synchronization signal, determine that the view node of the mini program has changed, and send a rendering instruction to the rendering engine. The view node is used to represent the native view of the mini program, and the rendering instruction is used to make the rendering engine render the rendering content of the native view corresponding to the changed view node to the display screen corresponding to the operating system to obtain the page of the mini program.
[0142] Optionally, the acquisition unit 61 includes: an acquisition module, configured to acquire a synchronization signal triggered by the operating system in response to the completion of the display refresh.
[0143] Optionally, the acquisition module includes an acquisition submodule, used to acquire a synchronization signal triggered by the operating system according to a time period in response to the completion of the display screen refresh according to a time period.
[0144] Optionally, the acquisition submodule is used to acquire a synchronization signal triggered by the operating system according to a time period in response to the completion of the display screen refresh according to a time period by the following steps: in response to the completion of the display screen vertical refresh according to a time period, acquire a vertical synchronization signal triggered by the operating system according to a time period, wherein the synchronization signal includes a vertical synchronization signal.
[0145] Optionally, the first sending unit includes: a determination module, used to determine that a view node has changed in response to the creation or updating of a view node.
[0146] Optionally, the device further includes a second sending unit for sending a view creation instruction to the rendering engine, wherein the view creation instruction is used to cause the rendering engine to create view nodes of the applet other than the modified view nodes.
[0147] In the page rendering apparatus for a mini-program according to this embodiment, a synchronization signal triggered by the operating system is acquired by an acquisition unit. The synchronization signal is pre-registered in the operating system and is used to trigger the rendering engine to render the page of the mini-program. The synchronization signal is also pre-registered in the interface of the operating system. In response to the triggered synchronization signal, a first sending unit determines that the view node of the mini-program has changed and sends a rendering instruction to the rendering engine. The view node represents the native view of the mini-program, and the rendering instruction causes the rendering engine to render and display the rendering content of the native view corresponding to the changed view node on the display screen corresponding to the operating system to obtain the page of the mini-program. This achieves the technical effect of improving page rendering efficiency and solves the technical problem of poor page rendering efficiency.
[0148] This disclosure also provides another method for performing... Figure 1 The page rendering method of the mini-program shown in the embodiment includes a page rendering device for the mini-program. The mini-program to be rendered runs in an operating system, which may include a native system and a rendering engine. The page rendering device for the mini-program can be applied to the rendering engine.
[0149] Figure 7 This is a schematic diagram of another page rendering apparatus for a mini-program according to an embodiment of the present disclosure. Figure 7 As shown, the page rendering device 70 of the mini-program may include a second acquisition unit 71 and a rendering unit 72.
[0150] The second acquisition unit 71 is used to acquire rendering instructions in response to changes in the view nodes of the mini program. The view nodes are used to represent the native view of the mini program. The result of the view node change is determined by the native system when it acquires the synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the interface of the operating system.
[0151] The rendering unit 72 is used to respond to rendering commands and render the content of the original view corresponding to the changed view node to the display screen of the operating system to obtain the page of the mini program.
[0152] In the page rendering apparatus for a mini-program according to this embodiment, the second acquisition unit acquires a rendering instruction in response to a change in the view node of the mini-program. The view node represents the native view of the mini-program, and the change in the view node is determined by the native system based on a synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the interface of the operating system. The rendering unit, in response to the rendering instruction, renders and displays the rendering content of the native view corresponding to the changed view node on the display screen corresponding to the operating system to obtain the page of the mini-program. This achieves the technical effect of improving page rendering efficiency and solves the technical problem of poor page rendering efficiency.
[0153] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0154] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0155] Embodiments of this disclosure provide an electronic device that may include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute the page rendering method of the applet according to the embodiments of this disclosure.
[0156] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0157] According to embodiments of this disclosure, this disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute a method for page rendering of an applet according to embodiments of this disclosure.
[0158] Optionally, in this embodiment, the non-volatile storage medium described above can be configured to store a computer program for performing the following steps:
[0159] S1, obtain the synchronization signal triggered by the operating system, wherein the synchronization signal is pre-registered in the interface of the operating system and is used to trigger the rendering engine to render the page of the applet;
[0160] S2, in response to the triggered synchronization signal, determines that the view node of the mini program has changed, and sends a rendering instruction to the rendering engine. The view node is used to represent the native view of the mini program, and the rendering instruction is used to make the rendering engine render the rendering content of the native view corresponding to the changed view node and display it on the screen corresponding to the operating system to obtain the page of the mini program.
[0161] Optionally, in this embodiment, the aforementioned non-transitory computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0162] According to embodiments of this disclosure, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0163] S1, obtain the synchronization signal triggered by the operating system, wherein the synchronization signal is pre-registered in the interface of the operating system and is used to trigger the rendering engine to render the page of the applet;
[0164] S2, in response to the triggered synchronization signal, determines that the view node of the mini program has changed, and sends a rendering instruction to the rendering engine. The view node is used to represent the native view of the mini program, and the rendering instruction is used to make the rendering engine render the rendering content of the native view corresponding to the changed view node and display it on the screen corresponding to the operating system to obtain the page of the mini program.
[0165] Figure 8 This is a block diagram of an electronic device for a page rendering method for a mini-program according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0166] like Figure 8As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0167] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0168] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as method data processing methods. For example, in some embodiments, the method data processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform data processing methods by any other suitable means (e.g., by means of firmware).
[0169] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0170] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0171] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination of the foregoing.
[0172] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0173] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0174] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0175] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0176] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for rendering a page in a WeChat Mini Program, comprising: The native system acquires a synchronization signal triggered by the operating system. This synchronization signal is pre-registered in the operating system's interface and is used to trigger the rendering engine to render the mini-program's page. The synchronization signal is a vertical synchronization signal, which is acquired by the native system and triggered by the operating system after the display screen completes a vertical refresh at a fixed time period. In response to the triggered vertical synchronization signal, the native system determines whether the mini-program's view nodes have changed since the last triggering of the vertical synchronization signal. If the view nodes have changed, the native system sends a rendering instruction to the rendering engine. The view nodes represent the mini-program's native view, and the rendering instruction causes the rendering engine to render and display the content of the native view corresponding to the changed view nodes on the display screen corresponding to the operating system, thereby obtaining the mini-program's page.
2. The method according to claim 1, wherein, Determining if the view nodes of the mini-program have changed includes: In response to creating or updating the view node, it is determined that the view node has changed.
3. The method according to any one of claims 1 to 2, wherein, Also includes: Send a view creation instruction to the rendering engine, wherein the view creation instruction is used to enable the rendering engine to create view nodes of the applet other than the modified view nodes.
4. A page rendering device for a mini-program, comprising: The acquisition unit is used to acquire a synchronization signal triggered by the operating system. The synchronization signal is pre-registered in the interface of the operating system and is used to trigger the rendering engine to render the page of the mini-program. The synchronization signal is a vertical synchronization signal, which is a signal acquired by the native system and triggered by the operating system after the display screen completes a vertical refresh at a fixed time period. The first sending unit is configured to, in response to the triggered vertical synchronization signal, determine whether the view node of the mini-program has changed since the last triggering of the vertical synchronization signal. If the view node has changed, the system sends a rendering instruction to the rendering engine. The view node represents the native view of the mini-program, and the rendering instruction causes the rendering engine to render and display the rendering content of the native view corresponding to the changed view node on the display screen corresponding to the operating system to obtain the page of the mini-program.
5. The apparatus according to claim 4, wherein, The first transmitting unit includes: A determination module is used to determine whether a view node has changed in response to the creation or updating of the view node.
6. The apparatus according to any one of claims 4 to 5, wherein, The device further includes: The second sending unit is used to send a view creation instruction to the rendering engine, wherein the view creation instruction is used to cause the rendering engine to create view nodes of the applet other than the modified view nodes.
7. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-3.
8. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-3.
9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-3.