[go: up one dir, main page]

CN113791988B - A rendering method, device and storage medium for reducing the volume of a small program package - Google Patents

A rendering method, device and storage medium for reducing the volume of a small program package Download PDF

Info

Publication number
CN113791988B
CN113791988B CN202111358693.8A CN202111358693A CN113791988B CN 113791988 B CN113791988 B CN 113791988B CN 202111358693 A CN202111358693 A CN 202111358693A CN 113791988 B CN113791988 B CN 113791988B
Authority
CN
China
Prior art keywords
memory space
type
video
topic
content
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111358693.8A
Other languages
Chinese (zh)
Other versions
CN113791988A (en
Inventor
刘宝华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CHANJET INFORMATION TECHNOLOGY CO LTD
Original Assignee
CHANJET INFORMATION TECHNOLOGY CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CHANJET INFORMATION TECHNOLOGY CO LTD filed Critical CHANJET INFORMATION TECHNOLOGY CO LTD
Priority to CN202111358693.8A priority Critical patent/CN113791988B/en
Publication of CN113791988A publication Critical patent/CN113791988A/en
Application granted granted Critical
Publication of CN113791988B publication Critical patent/CN113791988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

本发明提出了一种降低小程序包体积的渲染方法、装置及存储介质,该方法包括:当用户在电子设备上的小程序的界面上进行操作时,获取用户在电子设备中操作的数据对象类型;在所述电子设备的内存中申请第一内存空间,并获取其第一指针;如果所述数据对象类型为第一类型,则基于所述第一类型对所述第一内存空间进行调整得到第一调整内存空间,如果所述数据对象类型为第二类型,则基于所述第二类型对所述第一内存空间进行调整得到第二调整内存空间,根据所述数据对象类型加载所述数据对象的内容至所述第一或二调整内存空间,将所述内容从所述第一或二调整内存空间渲染至显示界面的view层供用户查看。降低了小程序的包的体积及对宿主程序的影响。

Figure 202111358693

The present invention provides a rendering method, device and storage medium for reducing the size of a small program package. The method includes: when a user operates on an interface of a small program on an electronic device, acquiring a data object operated by the user in the electronic device type; apply for a first memory space in the memory of the electronic device, and obtain its first pointer; if the data object type is the first type, adjust the first memory space based on the first type Obtain the first adjustment memory space, if the data object type is the second type, adjust the first memory space based on the second type to obtain the second adjustment memory space, and load the data object type according to the data object type. The content of the data object is sent to the first or second adjustment memory space, and the content is rendered from the first or second adjustment memory space to the view layer of the display interface for the user to view. The size of the applet package and the impact on the host program are reduced.

Figure 202111358693

Description

Rendering method and device for reducing volume of small program package and storage medium
Technical Field
The invention relates to the technical field of computer programs, in particular to a rendering method and a rendering device for reducing the volume of a small program package and a storage medium.
Background
The applet is a program which can be operated without downloading, and is dependent on other programs, also called a hosted program, a commonly used WeChat applet, which is an application that can be used without downloading, and is also an innovation, through the development of nearly two years, a new WeChat applet development environment and a developer ecology have been constructed, along with the increasing complexity of the applet functions, such as supporting functions of data display, video playing and the like, the volume of the applet is larger and larger, the memory occupied in operation is larger and larger, and the slow operation of the host program is inevitably caused, which is a defect in the prior art.
In the prior art, the management mode of the memory is complex, and the complex memory management method also causes the increase of the volume of the small program, so that the memory management needs to be considered in the process of program design for reducing the volume of the small program.
Disclosure of Invention
The present invention proposes the following technical solutions to address one or more technical defects in the prior art.
A rendering method for reducing a volume of a small package, the method being performed in an electronic device, the method comprising:
the method comprises the steps of obtaining the type of a data object operated by a user in the electronic equipment when the user operates on an interface of an applet on the electronic equipment;
an application step, namely applying a first memory space in a memory of the electronic equipment and acquiring a first pointer of the first memory space;
and a rendering step, wherein if the data object type is a first type, the first memory space is adjusted based on the first type to obtain a first adjusted memory space, if the data object type is a second type, the first memory space is adjusted based on the second type to obtain a second adjusted memory space, the content of the data object is loaded to the first adjusted memory space or the second adjusted memory space according to the data object type, and the content is rendered from the first adjusted memory space or the second adjusted memory space to a view layer of a display interface for a user to view based on the first pointer.
Further, the first type is video, and the second type is topic.
Further, in the acquiring step, based on the data object operated by the user in the electronic device, the applet acquires an identifier of the data object, and connects to the server to query the data object type of the data object based on the identifier.
Further, in the rendering step: if the first type is a video, the applet requests the server to obtain basic information of the video, obtains a representative frame of the video based on the basic information of the video, loads the representative frame of the video as first content into a first adjustment memory space, and renders the first content from the first adjustment memory space to a view layer of a display interface based on the first pointer to form a video interface for a user to view.
Further, in the rendering step: if the second type is a topic, the applet requests the server to obtain basic information of the topic, whether the topic comprises a plurality of topic videos is judged based on the basic information of the topic, if so, an array Arr [ n ] is created to store the URL of each topic video, the corresponding topic of each topic video is obtained based on each URL, the content representing the topic is obtained from the basic information of the topic, the content of the topic and the topic of each topic video are loaded into a second adjustment memory space as second content, and then the second content is rendered from the second adjustment memory space to a view layer of a display interface based on the first pointer to form a topic interface for a user to view.
Furthermore, when a user clicks a topic of a topic video on a topic interface, a corresponding topic video URL is obtained based on the array Arr [ n ], the applet requests the server to obtain basic information of the topic video, the size of a representative frame of the topic video is obtained based on the basic information, the second adjustment memory space is adjusted again based on the size of the representative frame of the topic video to obtain a third adjustment memory space, the representative frame of the topic video is obtained based on the basic information of the topic video, and the representative frame of the video is loaded into the third adjustment memory space as content.
The invention also provides a rendering device for reducing the volume of the small program package, which is arranged in the electronic equipment to execute, and the device comprises:
the acquisition unit is used for acquiring the data object type operated by the user in the electronic equipment when the user operates on the interface of the small program on the electronic equipment;
the application unit is used for applying for a first memory space in the memory of the electronic equipment and acquiring a first pointer of the first memory space;
and the rendering unit is used for adjusting the first memory space based on the first type to obtain a first adjusted memory space if the data object type is the first type, adjusting the first memory space based on the second type to obtain a second adjusted memory space if the data object type is the second type, loading the content of the data object to the first adjusted memory space or the second adjusted memory space according to the data object type, and rendering the content from the first adjusted memory space or the second adjusted memory space to a view layer of a display interface for a user to view based on the first pointer.
Further, the first type is video, and the second type is topic.
Still further, in the acquiring unit, based on a data object operated by a user in the electronic device, the applet acquires an identifier of the data object, and connects to the server to query a data object type of the data object based on the identifier.
Further, in the rendering unit: if the first type is a video, the applet requests the server to obtain basic information of the video, obtains a representative frame of the video based on the basic information of the video, loads the representative frame of the video as first content into a first adjustment memory space, and renders the first content from the first adjustment memory space to a view layer of a display interface based on the first pointer to form a video interface for a user to view.
Further, in the rendering unit: if the second type is a topic, the applet requests the server to obtain basic information of the topic, whether the topic comprises a plurality of topic videos is judged based on the basic information of the topic, if so, an array Arr [ n ] is created to store the URL of each topic video, the corresponding topic of each topic video is obtained based on each URL, the content representing the topic is obtained from the basic information of the topic, the content of the topic and the topic of each topic video are loaded into a second adjustment memory space as second content, and then the second content is rendered from the second adjustment memory space to a view layer of a display interface based on the first pointer to form a topic interface for a user to view.
Furthermore, when a user clicks a topic of a topic video on a topic interface, a corresponding topic video URL is obtained based on the array Arr [ n ], the applet requests the server to obtain basic information of the topic video, the size of a representative frame of the topic video is obtained based on the basic information, the second adjustment memory space is adjusted again based on the size of the representative frame of the topic video to obtain a third adjustment memory space, the representative frame of the topic video is obtained based on the basic information of the topic video, and the representative frame of the video is loaded into the third adjustment memory space as content.
The invention also proposes a computer-readable storage medium having stored thereon computer program code which, when executed by a computer, performs any of the methods described above.
The invention has the technical effects that: the invention discloses a rendering method, a device, equipment and a storage medium for reducing the volume of a small program package, wherein the method comprises the following steps: the method comprises the steps of obtaining the type of a data object operated by a user in the electronic equipment when the user operates on an interface of an applet on the electronic equipment; an application step, namely applying a first memory space in a memory of the electronic equipment and acquiring a first pointer of the first memory space; and a rendering step, wherein if the data object type is a first type, the first memory space is adjusted based on the first type to obtain a first adjusted memory space, if the data object type is a second type, the first memory space is adjusted based on the second type to obtain a second adjusted memory space, the content of the data object is loaded to the first adjusted memory space or the second adjusted memory space according to the data object type, and the content is rendered from the first adjusted memory space or the second adjusted memory space to a view layer of a display interface for a user to view based on the first pointer. In the invention, the first memory space is applied by the host program according to the type of the applet, namely, the memory relation tables corresponding to different applets are established in the host program, when a user starts one applet, the host program applies the corresponding first memory space according to the relation, the efficiency of memory application is improved due to the establishment of the relation tables, the content of the applet is reduced due to the setting of the relation tables in the host program, and the packet volume of the applet is reduced; in the invention, in order to improve the system performance, the applied first memory is relatively small, in the subsequent operation process, the first memory space needs to be adjusted according to the data object of the actual operation of the user on the small program, the initial address of the adjusted memory space is kept unchanged, namely the pointer of the adjusted memory space is unchanged, thus reducing the complex memory application mechanism in the small program, reducing the code of the small program and reducing the volume of the small program; in the invention, the display interface of the small program only needs to be provided with a basic initial interface, so that the volume of the small program package is reduced, and the content displayed on the small program package at the later stage is matched with the adjustment of the memory according to the type of the content, so that the content display is quick, the memory consumption is low, the operation efficiency of the small program is improved, the influence on the host program is reduced, and the user experience is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings.
Fig. 1 is a flowchart of a rendering method for reducing a small package volume according to an embodiment of the present invention.
Fig. 2 is a block diagram of a rendering apparatus for reducing a small package volume according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows a rendering method for reducing the volume of a small program package according to the present invention, which is executed in an electronic device, where a small program refers to a program that can be run without downloading, and depends on other programs, also called hosted programs, and commonly used small program with little trust, where the small program is an application that can be used without downloading, and is also an innovation, and through the development of nearly two years, a new small program development environment and a new developer ecology have been constructed, and as the functions of the small program become more complex, such as supporting functions of data display, video playing, etc., the volume of the small program is larger and larger, and the memory occupied during running is also larger and larger, which inevitably results in slow running of the host program, which is a defect in the prior art.
The method comprises the following steps:
an obtaining step S101, when a user operates on an interface of an applet on the electronic equipment, obtaining a data object type operated by the user in the electronic equipment;
an application step S102, of applying for a first memory space in a memory of the electronic device, and acquiring a first pointer of the first memory space;
a rendering step S103, if the data object type is a first type, adjusting the first memory space based on the first type to obtain a first adjusted memory space, if the data object type is a second type, adjusting the first memory space based on the second type to obtain a second adjusted memory space, loading the content of the data object to the first adjusted memory space or the second adjusted memory space according to the data object type, and rendering the content from the first adjusted memory space or the second adjusted memory space to a view layer of a display interface for a user to view based on the first pointer.
In the invention, the first memory space is applied by the host program according to the type of the applet, namely, the memory relation tables corresponding to different applets are established in the host program, when a user starts one applet, the host program applies the corresponding first memory space according to the relation, the efficiency of memory application is improved due to the establishment of the relation tables, the content of the applet is reduced due to the fact that the relation tables are arranged in the host program, and the packet volume of the applet is reduced, which is an important invention point of the invention.
In the invention, in order to improve the system performance, the applied first memory is relatively small, in the subsequent operation process, the first memory space needs to be adjusted according to the data object of the actual operation of the user on the applet, the initial address of the adjusted memory space is kept unchanged, namely the pointer of the adjusted memory space is unchanged, so that the complex memory application mechanism in the applet is reduced, the code of the applet is reduced, and the volume of the applet is reduced, which is another important invention point of the invention.
In one embodiment, the first data type is video and the second data type is topical. In the obtaining step S101, based on a data object operated by a user in an electronic device, the applet obtains an identifier of the data object, and connects to a server to query a data object type of the data object based on the identifier. The identification of the data object may be an ID, URL, or the like.
In one embodiment, in the rendering step S103: if the first data type is a video, the applet requests the server to obtain basic information of the video, obtains a representative frame of the video based on the basic information of the video, loads the representative frame of the video as first content into a first adjustment memory space, and renders the first content from the first adjustment memory space to a view layer of a display interface based on the first pointer to form a video interface for a user to view.
In the invention, after the data object type is determined to be a first type, that is, the first type is a video, the first memory space is adjusted based on the first type to obtain a first adjusted memory space, because the content of the video is large, in order to smoothly play the video, the first memory space needs to be increased so that the video can be smoothly played, then a representative frame of the video is obtained and loaded into the first adjusted memory space as a first content, and then the first content is rendered from the first adjusted memory space to a view layer of a display interface based on the first pointer to form a video interface for a user to view, so that the problem that the video playing is not smooth due to slow and small running of other applications due to excessively large memory space applied in advance is solved, and the invention belongs to another important invention point of the invention.
In one embodiment, in the rendering step S103: and if the second data type is a topic, the applet requests the server to obtain basic information of the topic, judges whether the topic comprises a plurality of topic videos based on the basic information of the topic, if so, creates an array Arr [ n ] to store the URL of each topic video, obtains the corresponding topic of each topic video based on each URL, obtains the content representing the topic from the basic information of the topic, loads the content of the topic and the topic of each topic video into a second adjustment memory space as second content, and renders the second content from the second adjustment memory space to a view layer of a display interface based on the first pointer to form a topic interface for a user to view, wherein n is the number of the topic videos. The topic may be a page including a plurality of topic videos, and the page includes a topic of the topic and a topic of the plurality of topic videos, for example, a topic is an 'accounting training lecture', and links of the plurality of topic videos are included below the page, and each link is displayed on the topic of the topic video.
In one embodiment, when a user clicks a topic of a topic video on a topic interface, a corresponding topic video URL is acquired based on the array Arr [ n ], the applet requests the server to acquire basic information of the topic video, acquires a size of a representative frame of the topic video based on the basic information, readjusts the second adjusted memory space based on the size of the representative frame of the topic video to obtain a third adjusted memory space, acquires the representative frame of the topic video based on the basic information of the topic video, and loads the representative frame of the video as content into the third adjusted memory space.
In the invention, as the memory required for only displaying one thematic interface is smaller, the second adjustment memory space is smaller than the first adjustment memory space of the video, thus, when a user browses a thematic page, if the user needs to check the thematic video, the second adjustment memory space is adjusted again, the second adjustment memory space can be adjusted to be multiple times, such as 10-20 times and the like, of the size of a representative frame of the thematic video, then the thematic video is rendered from the second adjustment memory space to a view layer of a display interface based on the first pointer to form a thematic video interface for the user to check, and the URL of the corresponding thematic video is recorded by an array, so that the user can conveniently click the corresponding thematic video and quickly obtain the link of the thematic video, in the invention, the display interface of a small program only needs to be provided with a basic initial interface, thereby reducing the volume of a small program package, and the content displayed on the post-stage is matched with the adjustment of the memory according to the type of the content, so that the content is displayed quickly, the memory consumption is small, the running efficiency of the small program is improved, the influence on the host program is reduced, and the user experience is improved.
Fig. 2 shows a rendering apparatus for reducing the volume of a small program package according to the present invention, which is disposed in an electronic device, where the small program refers to a program that can be run without downloading, and depends on other programs, also called hosted programs, and commonly used small program with little trust, where the small program is an application that can be used without downloading, and is also an innovation, and through the development of nearly two years, a new small program development environment and a new developer ecology have been constructed, and as the functions of the small program become more complex, such as supporting functions of data display, video playing, etc., the volume of the small program is larger and larger, and the memory occupied during running is also larger and larger, which inevitably results in slow running of the host program, which is a defect in the prior art. The device includes:
an acquisition unit 201, which acquires the data object type operated by the user in the electronic device when the user operates on the interface of the small program on the electronic device;
an applying unit 202, configured to apply for a first memory space in a memory of the electronic device, and obtain a first pointer of the first memory space;
a rendering unit 203, configured to, if the data object type is a first type, adjust the first memory space based on the first type to obtain a first adjusted memory space, if the data object type is a second type, adjust the first memory space based on the second type to obtain a second adjusted memory space, load the content of the data object to the first adjusted memory space or the second adjusted memory space according to the data object type, and render the content from the first adjusted memory space or the second adjusted memory space to a view layer of a display interface for a user to view based on the first pointer.
In the invention, the first memory space is applied by the host program according to the type of the applet, namely, the memory relation tables corresponding to different applets are established in the host program, when a user starts one applet, the host program applies the corresponding first memory space according to the relation, the efficiency of memory application is improved due to the establishment of the relation tables, the content of the applet is reduced due to the fact that the relation tables are arranged in the host program, and the packet volume of the applet is reduced, which is an important invention point of the invention.
In the invention, in order to improve the system performance, the applied first memory is relatively small, in the subsequent operation process, the first memory space needs to be adjusted according to the data object of the actual operation of the user on the applet, the initial address of the adjusted memory space is kept unchanged, namely the pointer of the adjusted memory space is unchanged, so that the complex memory application mechanism in the applet is reduced, the code of the applet is reduced, and the volume of the applet is reduced, which is another important invention point of the invention.
In one embodiment, the first data type is video and the second data type is topical. In the obtaining unit 201, based on a data object operated by a user in an electronic device, the applet obtains an identifier of the data object, and connects to a server to query a data object type of the data object based on the identifier. The identification of the data object may be an ID, URL, or the like.
In one embodiment, in the rendering unit 203: if the first data type is a video, the applet requests the server to obtain basic information of the video, obtains a representative frame of the video based on the basic information of the video, loads the representative frame of the video as first content into a first adjustment memory space, and renders the first content from the first adjustment memory space to a view layer of a display interface based on the first pointer to form a video interface for a user to view.
In the invention, after the data object type is determined to be a first type, that is, the first type is a video, the first memory space is adjusted based on the first type to obtain a first adjusted memory space, because the content of the video is large, in order to smoothly play the video, the first memory space needs to be increased so that the video can be smoothly played, then a representative frame of the video is obtained and loaded into the first adjusted memory space as a first content, and then the first content is rendered from the first adjusted memory space to a view layer of a display interface based on the first pointer to form a video interface for a user to view, so that the problem that the video playing is not smooth due to slow and small running of other applications due to excessively large memory space applied in advance is solved, and the invention belongs to another important invention point of the invention.
In one embodiment, in the rendering unit 203: and if the second data type is a topic, the applet requests the server to obtain basic information of the topic, judges whether the topic comprises a plurality of topic videos based on the basic information of the topic, if so, creates an array Arr [ n ] to store the URL of each topic video, obtains the corresponding topic of each topic video based on each URL, obtains the content representing the topic from the basic information of the topic, loads the content of the topic and the topic of each topic video into a second adjustment memory space as second content, and renders the second content from the second adjustment memory space to a view layer of a display interface based on the first pointer to form a topic interface for a user to view, wherein n is the number of the topic videos. The topic may be a page including a plurality of topic videos, and the page includes a topic of the topic and a topic of the plurality of topic videos, for example, a topic is an 'accounting training lecture', and links of the plurality of topic videos are included below the page, and each link is displayed on the topic of the topic video.
In one embodiment, when a user clicks a topic of a topic video on a topic interface, a corresponding topic video URL is acquired based on the array Arr [ n ], the applet requests the server to acquire basic information of the topic video, acquires a size of a representative frame of the topic video based on the basic information, readjusts the second adjusted memory space based on the size of the representative frame of the topic video to obtain a third adjusted memory space, acquires the representative frame of the topic video based on the basic information of the topic video, and loads the representative frame of the video as content into the third adjusted memory space.
In the invention, as the memory required for only displaying one thematic interface is smaller, the second adjustment memory space is smaller than the first adjustment memory space of the video, thus, when a user browses a thematic page, if the user needs to check the thematic video, the second adjustment memory space is adjusted again, the second adjustment memory space can be adjusted to be multiple times, such as 10-20 times and the like, of the size of a representative frame of the thematic video, then the thematic video is rendered from the second adjustment memory space to a view layer of a display interface based on the first pointer to form a thematic video interface for the user to check, and the URL of the corresponding thematic video is recorded by an array, so that the user can conveniently click the corresponding thematic video and quickly obtain the link of the thematic video, in the invention, the display interface of a small program only needs to be provided with a basic initial interface, thereby reducing the volume of a small program package, and the content displayed on the post-stage is matched with the adjustment of the memory according to the type of the content, so that the content is displayed quickly, the memory consumption is small, the running efficiency of the small program is improved, the influence on the host program is reduced, and the user experience is improved.
The invention provides a rendering device for reducing the volume of a small program package, which comprises a processor and a memory, wherein the processor is connected with the processor through a bus, the memory is stored with a computer program, the processor executes the computer program on the memory to realize the method, and the device can be a desktop computer, a server, a notebook, an intelligent terminal and the like.
An embodiment of the present invention provides a computer storage medium, on which a computer program is stored, which when executed by a processor implements the above-mentioned method, and the computer storage medium can be a hard disk, a DVD, a CD, a flash memory, or the like.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially implemented or the portions that contribute to the prior art may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the apparatuses described in the embodiments or some portions of the embodiments of the present application.
Finally, it should be noted that: although the present invention has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that: modifications and equivalents may be made thereto without departing from the spirit and scope of the invention and it is intended to cover in the claims the invention as defined in the appended claims.

Claims (10)

1.一种降低小程序包体积的渲染方法,该方法在电子设备中执行,其特征在于,该方法包括:1. A rendering method that reduces the volume of a small program package, the method is performed in an electronic device, and is characterized in that, the method comprises: 获取步骤,当用户在电子设备上的小程序的界面上进行操作时,获取用户在电子设备中操作的数据对象类型;The obtaining step, when the user operates on the interface of the applet on the electronic device, obtains the data object type operated by the user in the electronic device; 申请步骤,在所述电子设备的内存中申请第一内存空间,并获取该第一内存空间的第一指针,第一内存空间为宿主程序根据小程序的类型申请的,即在宿主程序中建立了不同的小程序对应的内存关系表,当用户启动一个小程序时,宿主程序根据该关系表申请对应的第一内存空间,申请的第一内存空间相对较小,在后续的操作过程中,需要根据用户在小程序上的实际操作的数据对象对该第一内存空间进行调整,调整后的内存空间的起始地址保持不变,也就是调整后的内存空间的指针是不变的;The application step is to apply for a first memory space in the memory of the electronic device, and obtain a first pointer of the first memory space. The first memory space is applied by the host program according to the type of the applet, that is, it is established in the host program. When the user starts an applet, the host program applies for the corresponding first memory space according to the relationship table, and the applied first memory space is relatively small. In the subsequent operation process, The first memory space needs to be adjusted according to the data objects actually operated by the user on the applet, and the starting address of the adjusted memory space remains unchanged, that is, the pointer of the adjusted memory space remains unchanged; 渲染步骤,如果所述数据对象类型为第一类型,则基于所述第一类型对所述第一内存空间进行调整得到第一调整内存空间,如果所述数据对象类型为第二类型,则基于所述第二类型对所述第一内存空间进行调整得到第二调整内存空间,根据所述数据对象类型加载数据对象的内容至所述第一调整内存空间或第二调整内存空间,基于所述第一指针将所述内容从所述第一调整内存空间或第二调整内存空间渲染至显示界面的view层供用户查看。In the rendering step, if the data object type is the first type, adjusting the first memory space based on the first type to obtain a first adjusted memory space, and if the data object type is the second type, adjusting the first memory space based on the first type. The second type adjusts the first memory space to obtain a second adjusted memory space, loads the content of the data object according to the data object type into the first adjusted memory space or the second adjusted memory space, based on the The first pointer renders the content from the first adjustment memory space or the second adjustment memory space to the view layer of the display interface for the user to view. 2.根据权利要求1所述的方法,其特征在于,所述第一类型为视频,所述第二类型为专题。2. The method according to claim 1, wherein the first type is video, and the second type is topic. 3.根据权利要求2所述的方法,其特征在于,在所述获取步骤中,基于用户在电子设备中操作的数据对象,所述小程序获取所述数据对象的标识,基于所述标识连接服务器查询所述数据对象的数据对象类型。3. The method according to claim 2, wherein in the obtaining step, the applet obtains the identifier of the data object based on the data object operated by the user in the electronic device, and connects based on the identifier The server queries the data object for the data object type. 4.根据权利要求3所述的方法,其特征在于,在所述渲染步骤中:如果所述第一类型为视频,所述小程序请求所述服务器,获取所述视频的基本信息,基于所述视频的基本信息获取所述视频的代表帧,将所述视频的代表帧作为第一内容加载至第一调整内存空间中,然后基于所述第一指针将所述第一内容从所述第一调整内存空间渲染至显示界面的view层形成视频界面供用户查看。4. The method according to claim 3, wherein in the rendering step: if the first type is video, the applet requests the server to obtain basic information of the video, based on the Obtain the representative frame of the video from the basic information of the video, load the representative frame of the video as the first content into the first adjustment memory space, and then load the first content from the first content based on the first pointer. An adjusted memory space is rendered to the view layer of the display interface to form a video interface for the user to view. 5.根据权利要求4所述的方法,其特征在于,在所述渲染步骤中:如果所述第二类型为专题时,所述小程序请求所述服务器,获取所述专题的基本信息,基于所述专题的基本信息判断所述专题是否包含多个专题视频,如果是,则创建一数组Arr[n]保存每个专题视频的URL,基于每个URL获取对应的每个专题视频的主题,从所述专题的基本信息中获取代表该专题的内容,将所述专题的内容和每个专题视频的主题作为第二内容加载到第二调整内存空间中,然后基于所述第一指针将所述第二内容从所述第二调整内存空间渲染至显示界面的view层形成专题界面供用户查看,其中n为专题视频的个数。5. The method according to claim 4, wherein, in the rendering step: if the second type is a topic, the applet requests the server to obtain basic information of the topic, based on the The basic information of the topic judges whether the topic contains a plurality of topic videos, if so, then create an array Arr[n] to save the URL of each topic video, and obtain the theme of each topic video corresponding to each URL, Obtain the content representing the theme from the basic information of the theme, load the content of the theme and the theme of each theme video into the second adjustment memory space as the second content, and then load the content of the theme based on the first pointer The second content is rendered from the second adjusted memory space to the view layer of the display interface to form a thematic interface for the user to view, wherein n is the number of thematic videos. 6.一种降低小程序包体积的渲染装置,该装置设置在电子设备中执行,其特征在于,该装置包括:6. A rendering device for reducing the volume of a small program package, the device is configured to be executed in an electronic device, wherein the device comprises: 获取单元,当用户在电子设备上的小程序的界面上进行操作时,获取用户在电子设备中操作的数据对象类型;an obtaining unit, when the user operates on the interface of the applet on the electronic device, obtains the data object type operated by the user in the electronic device; 申请单元,在所述电子设备的内存中申请第一内存空间,并获取该第一内存空间的第一指针,第一内存空间为宿主程序根据小程序的类型申请的,即在宿主程序中建立了不同的小程序对应的内存关系表,当用户启动一个小程序时,宿主程序根据该关系表申请对应的第一内存空间,申请的第一内存空间相对较小,在后续的操作过程中,需要根据用户在小程序上的实际操作的数据对象对该第一内存空间进行调整,调整后的内存空间的起始地址保持不变,也就是调整后的内存空间的指针是不变的;The application unit applies for the first memory space in the memory of the electronic device, and obtains the first pointer of the first memory space. The first memory space is applied by the host program according to the type of the applet, that is, it is established in the host program When the user starts an applet, the host program applies for the corresponding first memory space according to the relationship table, and the applied first memory space is relatively small. In the subsequent operation process, The first memory space needs to be adjusted according to the data objects actually operated by the user on the applet, and the starting address of the adjusted memory space remains unchanged, that is, the pointer of the adjusted memory space remains unchanged; 渲染单元,如果所述数据对象类型为第一类型,则基于所述第一类型对所述第一内存空间进行调整得到第一调整内存空间,如果所述数据对象类型为第二类型,则基于所述第二类型对所述第一内存空间进行调整得到第二调整内存空间,根据所述数据对象类型加载数据对象的内容至所述第一调整内存空间或第二调整内存空间,基于所述第一指针将所述内容从所述第一调整内存空间或第二调整内存空间渲染至显示界面的view层供用户查看。The rendering unit, if the data object type is the first type, adjust the first memory space based on the first type to obtain a first adjusted memory space, and if the data object type is the second type, adjust the first memory space based on the first type The second type adjusts the first memory space to obtain a second adjusted memory space, loads the content of the data object according to the data object type into the first adjusted memory space or the second adjusted memory space, based on the The first pointer renders the content from the first adjustment memory space or the second adjustment memory space to the view layer of the display interface for the user to view. 7.根据权利要求6所述的装置,其特征在于,在所述获取单元中,基于用户在电子设备中操作的数据对象,所述小程序获取所述数据对象的标识,基于所述标识连接服务器查询所述数据对象的数据对象类型。7 . The apparatus according to claim 6 , wherein, in the obtaining unit, based on a data object operated by a user in an electronic device, the applet obtains an identifier of the data object, and connects based on the identifier. 8 . The server queries the data object for the data object type. 8.根据权利要求7所述的装置,其特征在于,在所述渲染单元中:如果所述第一类型为视频,所述小程序请求所述服务器,获取所述视频的基本信息,基于所述视频的基本信息获取所述视频的代表帧,将所述视频的代表帧作为第一内容加载至第一调整内存空间中,然后基于所述第一指针将所述第一内容从所述第一调整内存空间渲染至显示界面的view层形成视频界面供用户查看。8 . The apparatus according to claim 7 , wherein, in the rendering unit: if the first type is video, the applet requests the server to obtain basic information of the video, based on the Obtain the representative frame of the video from the basic information of the video, load the representative frame of the video as the first content into the first adjustment memory space, and then load the first content from the first content based on the first pointer. An adjusted memory space is rendered to the view layer of the display interface to form a video interface for the user to view. 9.根据权利要求8所述的装置,其特征在于,在所述渲染单元中:如果所述第二类型为专题时,所述小程序请求所述服务器,获取所述专题的基本信息,基于所述专题的基本信息判断所述专题是否包含多个专题视频,如果是,则创建一数组Arr[n]保存每个专题视频的URL,基于每个URL获取对应的每个专题视频的主题,从所述专题的基本信息中获取代表该专题的内容,将所述专题的内容和每个专题视频的主题作为第二内容加载到第二调整内存空间中,然后基于所述第一指针将所述第二内容从所述第二调整内存空间渲染至显示界面的view层形成专题界面供用户查看,其中n为专题视频的个数。9 . The apparatus according to claim 8 , wherein, in the rendering unit: if the second type is a topic, the applet requests the server to acquire basic information of the topic, based on the The basic information of the topic judges whether the topic contains a plurality of topic videos, if so, then create an array Arr[n] to save the URL of each topic video, and obtain the theme of each topic video corresponding to each URL, Obtain the content representing the theme from the basic information of the theme, load the content of the theme and the theme of each theme video into the second adjustment memory space as the second content, and then load the content of the theme based on the first pointer The second content is rendered from the second adjusted memory space to the view layer of the display interface to form a thematic interface for the user to view, wherein n is the number of thematic videos. 10.一种计算机存储介质,所述计算机存储介质上存储有计算机程序,当所述计算机存储介质上的计算机程序被处理器执行时实现权利要求1-5任一项所述的方法。10. A computer storage medium on which a computer program is stored, and when the computer program on the computer storage medium is executed by a processor, the method according to any one of claims 1-5 is implemented.
CN202111358693.8A 2021-11-17 2021-11-17 A rendering method, device and storage medium for reducing the volume of a small program package Active CN113791988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111358693.8A CN113791988B (en) 2021-11-17 2021-11-17 A rendering method, device and storage medium for reducing the volume of a small program package

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111358693.8A CN113791988B (en) 2021-11-17 2021-11-17 A rendering method, device and storage medium for reducing the volume of a small program package

Publications (2)

Publication Number Publication Date
CN113791988A CN113791988A (en) 2021-12-14
CN113791988B true CN113791988B (en) 2022-02-18

Family

ID=78877358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111358693.8A Active CN113791988B (en) 2021-11-17 2021-11-17 A rendering method, device and storage medium for reducing the volume of a small program package

Country Status (1)

Country Link
CN (1) CN113791988B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109471671A (en) * 2017-09-06 2019-03-15 武汉斗鱼网络科技有限公司 A kind of program cold start-up method and system
CN109740085A (en) * 2019-01-10 2019-05-10 北京字节跳动网络技术有限公司 A kind of methods of exhibiting of content of pages, device, equipment and storage medium
CN109947504A (en) * 2019-03-29 2019-06-28 上海连尚网络科技有限公司 A method and device for executing a host program in a host program
CN110888740A (en) * 2019-11-22 2020-03-17 腾讯科技(深圳)有限公司 Incremental memory determining method, device and equipment of small program and storage medium
US10699368B1 (en) * 2017-08-30 2020-06-30 Apple Inc. Memory allocation techniques for graphics shader
CN111475246A (en) * 2020-04-10 2020-07-31 腾讯科技(深圳)有限公司 Applet page display method, device, terminal and storage medium
CN112214329A (en) * 2020-11-04 2021-01-12 腾讯科技(深圳)有限公司 Memory management method, device, equipment and computer readable storage medium
CN112331235A (en) * 2021-01-04 2021-02-05 腾讯科技(深圳)有限公司 Editing control method, device, electronic device and storage medium for multimedia content
CN112650692A (en) * 2019-10-12 2021-04-13 北京华为数字技术有限公司 Heap memory allocation method, device and storage medium
CN112861057A (en) * 2021-02-10 2021-05-28 北京百度网讯科技有限公司 Page rendering method, device and equipment based on small program and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8001336B2 (en) * 2007-03-02 2011-08-16 International Business Machines Corporation Deterministic memory management in a computing environment
US10162500B2 (en) * 2016-08-24 2018-12-25 Microsoft Technology Licensing, Llc Dynamically render large dataset in client application
CN110928737B (en) * 2018-09-19 2021-05-18 华为技术有限公司 Method and apparatus for monitoring memory access behavior of sample process
CN109800020B (en) * 2019-02-02 2023-02-10 北京字节跳动网络技术有限公司 Automatic code adjusting method, device, equipment and medium for program development
CN110113407B (en) * 2019-04-30 2021-08-17 上海连尚网络科技有限公司 Applet state synchronization method, device and computer storage medium
CN111061652B (en) * 2019-12-18 2021-12-31 中山大学 Nonvolatile memory management method and system based on MPI-IO middleware

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10699368B1 (en) * 2017-08-30 2020-06-30 Apple Inc. Memory allocation techniques for graphics shader
CN109471671A (en) * 2017-09-06 2019-03-15 武汉斗鱼网络科技有限公司 A kind of program cold start-up method and system
CN109740085A (en) * 2019-01-10 2019-05-10 北京字节跳动网络技术有限公司 A kind of methods of exhibiting of content of pages, device, equipment and storage medium
CN109947504A (en) * 2019-03-29 2019-06-28 上海连尚网络科技有限公司 A method and device for executing a host program in a host program
CN112650692A (en) * 2019-10-12 2021-04-13 北京华为数字技术有限公司 Heap memory allocation method, device and storage medium
CN110888740A (en) * 2019-11-22 2020-03-17 腾讯科技(深圳)有限公司 Incremental memory determining method, device and equipment of small program and storage medium
CN111475246A (en) * 2020-04-10 2020-07-31 腾讯科技(深圳)有限公司 Applet page display method, device, terminal and storage medium
CN112214329A (en) * 2020-11-04 2021-01-12 腾讯科技(深圳)有限公司 Memory management method, device, equipment and computer readable storage medium
CN112331235A (en) * 2021-01-04 2021-02-05 腾讯科技(深圳)有限公司 Editing control method, device, electronic device and storage medium for multimedia content
CN112861057A (en) * 2021-02-10 2021-05-28 北京百度网讯科技有限公司 Page rendering method, device and equipment based on small program and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Implementation of Elementary Chinese Language Learning Application in WeChat Mini Programs;Xijie Wang 等;《2019 IEEE 4th International Conference on Big Data Analytics (ICBDA)》;20190513;第394-398页 *
基于微信小程序的气象服务系统;陆卫荣 等;《电脑编程技巧与维护》;20190630;第74-77页 *

Also Published As

Publication number Publication date
CN113791988A (en) 2021-12-14

Similar Documents

Publication Publication Date Title
US9672022B2 (en) Applications including multiple experience modules
US9940119B2 (en) Providing limited versions of applications
EP2443609B1 (en) Persistent media playback
US9116999B2 (en) Pre-fetching of network page content
CN103617191B (en) Use the hardware-accelerated method and browser for realizing that browser renders
RU2619181C2 (en) System and method for downloadable content transmission optimizing
WO2017166447A1 (en) Method and device for loading kernel module
EP3267325B1 (en) Page phase time
US10108437B2 (en) Rendition of a content editor
US8682964B1 (en) Progressively loading network content
US11397555B2 (en) Background pre-loading and refreshing of applications with audio inhibition
US9626197B1 (en) User interface rendering performance
CN107807934A (en) Page display method and device and computing device
CN108062336B (en) Media information processing method and device
CN105759938A (en) Energy-saving method and equipment for mobile terminal
CN117235393A (en) Self-adaptive page loading method and device, equipment and storage medium
CN109656670B (en) Page rendering method and device
CN113791988B (en) A rendering method, device and storage medium for reducing the volume of a small program package
CN112015482B (en) Page loading method, device and server
WO2017107835A1 (en) Browser starting method and apparatus
US20170032552A1 (en) Implementing out of order access to reversal operations in images
CN109857966A (en) A kind of optimization method and browser of browser dynamically load web page resources
CN115186207A (en) Method and device for loading page resources and electronic equipment
US20210410056A1 (en) Technologies for detecting and analyzing user interaction tests for network-accessible content
WO2016183795A1 (en) Method, apparatus for loading a resource in a web page on a device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
OL01 Intention to license declared
OL01 Intention to license declared