Component adjustment method, device and computer storage medium

By converting dynamic type application components into static type application components in the Flutter application development stage, the problem of dynamic type application components occupying too high system memory is solved, and the application operation efficiency and stability is improved.

CN111538528BActive Publication Date: 2025-05-06SHENZHEN TCL DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010314536.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-20
Publication Date
2025-05-06
Estimated Expiration
2040-04-20

AI Technical Summary

Technical Problem

In applications developed based on the Flutter framework, dynamic type application components occupy too high system running memory, resulting in reduced system operation efficiency and even causing abnormal phenomena such as application crashes.

Method used

By obtaining all application components of the application object to be adjusted in the development stage, extracting their state parent components and determining the first state parent component of the dynamic type, obtaining the second state parent component of the static type from the preset database, deleting the first state parent component and generating the target adjustment component to reduce the number and memory usage of the dynamic type application components.

Benefits of technology

It effectively reduces the occupancy rate of system running memory by dynamic type application components, ensures the normal operation of applications, and improves the application's data processing capabilities and operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111538528B_ABST
    Figure CN111538528B_ABST
Patent Text Reader

Abstract

The present invention discloses a component adjustment method, device and computer storage medium, the component adjustment method comprising: obtaining an application object to be adjusted, and obtaining all application components of the application object to be adjusted; extracting the state parent component of each application component, and obtaining the state type corresponding to each state parent component; determining the first state parent component whose state type is a dynamic type; according to the first state parent component, obtaining the second state parent component whose state type is a static type from a preset database; obtaining the attribute information of the first state parent component, deleting the first state parent component, and generating a target adjustment component according to the second state parent component and the attribute information. The present invention avoids too many dynamic type application components occupying the system running memory, thereby improving the data processing capability of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of application component development, and in particular to a component adjustment method, device and computer storage medium. Background Art

[0002] Flutter is a UI framework proposed by Google. It is used by developers and organizations all over the world due to its many advantages, such as responsive framework design, convenient access to native platform functions, extremely convenient hot reload development experience, and frame rate comparable to native.

[0003] For applications developed based on the Flutter framework, the running memory occupied by the application components will be constrained by the system garbage collection mechanism. The garbage collection mechanism will perform memory recycling for static application components, but the recycling efficiency for dynamic application components is very low, which will cause the number of dynamic application components to continue to accumulate.

[0004] The continuously accumulated and increasing number of dynamic application components will occupy the system's valuable running memory, making the system running memory usage very high. As a result, the application cannot call enough running memory, resulting in a decrease in data processing capabilities, and even causing abnormal phenomena such as application crashes, which greatly reduces the running efficiency of the application. Summary of the invention

[0005] The main purpose of the present invention is to provide a component adjustment method, device and computer storage medium, aiming to avoid too many dynamic type application components occupying the system running memory, thereby improving the data processing capability of the application.

[0006] To achieve the above object, an embodiment of the present invention provides a component adjustment method, the component adjustment method comprising:

[0007] Acquire the application object to be adjusted, and acquire all application components of the application object to be adjusted;

[0008] Extract the state parent component of each application component, and obtain the state type corresponding to each state parent component;

[0009] Determine the first state parent component of all state types that are dynamic types;

[0010] According to the first state parent component, a second state parent component whose state type is a static type is obtained from a preset database;

[0011] Acquire the attribute information of the first-state parent component, delete the first-state parent component, and generate a target adjustment component according to the second-state parent component and the attribute information.

[0012] Optionally, the step of acquiring, from a preset database, a second state parent component whose state type is a static type according to the first state parent component includes:

[0013] Obtain component category information of the parent component of the first state;

[0014] Determine all state inheritance sources in a preset database, and determine a target state inheritance source from all state inheritance sources according to the component category information;

[0015] According to the component category information, a second state parent component whose state type is a static type is obtained from the target state inheritance source.

[0016] Optionally, the step of acquiring the attribute information of the first-state parent component, deleting the first-state parent component, and generating a target adjustment component according to the second-state parent component and the attribute information includes:

[0017] Obtain all first edit properties of the parent component in the first state and target property information corresponding to the first edit properties;

[0018] Delete the parent component of the first state, and obtain the second editing attribute of the parent component of the second state;

[0019] According to the attribute mapping relationship between the first editing attribute and the second editing attribute, the target attribute information is stored in the second editing attribute to generate a target adjustment component.

[0020] Optionally, the step of saving the target attribute information into the second edit attribute to generate a target adjustment component includes:

[0021] The target attribute information is saved in the second edit attribute, and the second edit attribute is initialized to obtain a first initialization state;

[0022] If the first initialization state is an initialization failure state, obtaining target initialization parameters in the parent component of the first state, and obtaining default initialization parameters in the parent component of the second state;

[0023] Updating the default initialization parameters to target initialization parameters to generate an updated second-state parent component;

[0024] Based on the updated second state parent component, initializing the second editing attribute to obtain a second initialization state;

[0025] If the second initialization state is an initialization success state, the updated second state parent component is confirmed as a target adjustment component.

[0026] Optionally, the step of storing the target attribute information in a second editing attribute to generate a target adjustment component further includes:

[0027] The target attribute information is saved in the second edit attribute, and the called state of the updated second state parent component is obtained;

[0028] If the called state is a calling success state, a target adjustment component is generated according to the updated second state parent component.

[0029] Optionally, after the step of generating a target adjustment component according to the second state parent component and the attribute information, the step further includes:

[0030] Obtaining a first nested call state of the target adjustment component;

[0031] If the first nested call state is a call failure state, obtaining component nesting association parameters of the first state parent component, and obtaining default nesting association parameters of the target adjustment component;

[0032] Updating the default nested association parameters to component nested association parameters, and deleting the default nested association parameters to generate a new target adjustment component;

[0033] Obtaining a second nested call state of the new target adjustment component;

[0034] If the second nested call state is a call failure state, a prompt message indicating component call exception is output.

[0035] Optionally, after the step of generating a target adjustment component according to the second state parent component and the attribute information, the step further includes:

[0036] Running the application object to be adjusted, and recording the memory usage of each target adjustment component in the application object to be adjusted;

[0037] Based on the memory usage, obtain the target calling frequency of each target adjustment component within a preset time;

[0038] Determine, from each target adjustment component, all high-frequency application components whose target call frequency is greater than a first frequency threshold;

[0039] The target calling frequency of the high-frequency application component is output.

[0040] Optionally, after the step of obtaining the target calling frequency of each target adjustment component within a preset time based on the memory occupancy, the step further includes:

[0041] Determine, from each target adjustment component, all low-frequency application components whose target call frequency is less than a second frequency threshold;

[0042] The target calling frequency of the low-frequency application component is output.

[0043] In addition, to achieve the above-mentioned purpose, the present invention further provides a device, the device comprising: a memory, a processor, and a component development program stored in the memory and executable on the processor, wherein:

[0044] When the component development program is executed by the processor, the steps of the component adjustment method described above are implemented.

[0045] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer storage medium;

[0046] The computer storage medium stores a component development program, and when the component development program is executed by the processor, the steps of the component adjustment method described above are implemented.

[0047] The present invention obtains an application object to be adjusted, and obtains all application components of the application object to be adjusted; extracts the state parent component of each application component, and obtains the state type corresponding to each state parent component; determines that all first state parent components have a dynamic state type; obtains a second state parent component with a static state type from a preset database according to the first state parent component; obtains the attribute information of the first state parent component, deletes the first state parent component, and generates a target adjustment component according to the second state parent component and the attribute information. The present invention reduces the number of dynamic type application components developed during the development phase, thereby greatly reducing the number of dynamic type application components running in the system memory, thereby reducing the occupancy rate of the dynamic type application components on the system running memory, ensuring the normal operation of the application, and further improving the data processing capability of the application to improve the application running efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0049] Figure 2 It is a flow chart of an embodiment of a component adjustment method of the present invention.

[0050] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION

[0051] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0052] The main idea of ​​the embodiment of the present invention is: the present invention obtains the application object to be adjusted, and obtains all application components of the application object to be adjusted; extracts the state parent component of each application component, and obtains the state type corresponding to each state parent component; determines the first state parent component whose state type is a dynamic type; according to the first state parent component, obtains the second state parent component whose state type is a static type from a preset database; obtains the attribute information of the first state parent component, deletes the first state parent component, and generates a target adjustment component according to the second state parent component and the attribute information. The present invention reduces the number of dynamic type application components developed during the development stage, so that the number of dynamic type application components running in the system memory is greatly reduced, thereby reducing the occupancy rate of the dynamic type application components to the system running memory, ensuring the normal operation of the application, and then improving the data processing capability of the application to improve the application operation efficiency.

[0053] The embodiments of the present invention take into account that in the prior art, the garbage collection mechanism will perform memory recycling for static type application components, while the recycling efficiency for dynamic type application components is very low, which will cause the number of dynamic type application components to accumulate continuously. The continuously accumulated and increasing dynamic type application components will occupy the precious running memory of the system, making the occupancy rate of the system running memory very high, causing the application to be unable to call enough running memory, resulting in a decrease in data processing capabilities, and even causing abnormal phenomena such as application flashback, thereby greatly reducing the running efficiency of the application.

[0054] The present invention provides a solution that can reduce the number of dynamic type application components developed during the development phase, thereby significantly reducing the number of dynamic type application components running in the system memory, thereby reducing the occupancy rate of the dynamic type application components on the system running memory, ensuring the normal operation of the application, and further improving the data processing capability of the application to improve the application running efficiency.

[0055] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.

[0056] The device in the embodiment of the present invention may be a PC or a server device.

[0057] like Figure 1As shown, the device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0058] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0059] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a component development program.

[0060] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the component development program stored in the memory 1005 and perform the operations in each embodiment of the following component adjustment method.

[0061] Based on the above hardware structure, an embodiment of the component adjustment method of the present invention is proposed.

[0062] The present invention provides a component adjustment method. In an embodiment of the component adjustment method, referring to Figure 2 , the component adjustment method comprises:

[0063] Step S10, obtaining the application object to be adjusted, and obtaining all application components of the application object to be adjusted;

[0064] All application objects to be adjusted in the present invention refer to applications that need to be adjusted as specified in the project requirements. In the present invention, the application objects to be adjusted will take applications developed based on the Flutter framework as an example. In the application development process based on the Flutter framework, the Flutter framework development regulations will be followed to specify that the application objects to be adjusted need to call various application component Widgets in the Flutter framework. The application component Widget is a small application program that can provide the basic properties of an application. For example, when the grid view component needs to be called, the application component GridVieW Widget can be directly called, and when the list view component needs to be called, the application component ListVieW Widget can be directly called, and so on.

[0065] The application component Widget will load a large number of subcomponents to display data. For example, to display a picture album, multiple subcomponent objects with the same layout can be loaded through the component properties of the GridView Widget component. Each subcomponent object is loaded with a picture and a picture description. Different subcomponent objects have their own pictures and picture descriptions, and the collection of these subcomponent objects is the picture album. It is understandable that for each application component Widget, if more subcomponent objects are loaded, the pictures and picture descriptions loaded by its subcomponent objects will also remain in the system. Even if the current user is not viewing the subcomponent object, the subcomponent object cannot be recycled by the system in time, thereby continuously consuming memory resources in the system, thereby reducing the data processing capacity of the application object to be adjusted during normal operation. To avoid this situation, it is necessary to further develop the application components called by the application object to be adjusted in the project requirements.

[0066] For example, if the current project requirement is to develop an application object named A to be adjusted based on the Flutter framework, then in this embodiment, it is necessary to determine the application object A to be adjusted and obtain various application component Widgets contained in the current A: a1, a2, and a3, etc.

[0067] Step S20, extracting the state parent component of each application component, and obtaining the state type corresponding to each state parent component;

[0068] In this embodiment, the unified basic building blocks of various application components are Widgets, and different application components retain the basic component properties of the basic building block Widget, that is, the application components derived from the basic building block Widget retain the attribute characteristics of the basic building block Widget. For example, Widget a1 calls Widget a, then Widget a1 retains all Widget properties of Widget a. Each Widget component is divided into two state parent components: StatelessWidget or StatefulWidget. The StatelessWidget is a stateless Widget component, that is, the internal properties of StatelessWidget are static and unchanged. StatefulWidget is a stateful Widget, and the state change in StatefulWidget is implemented through the setState{} method. In essence, the change of user interaction operation will change the parameter passed in setState{}, and this parameter passes in setState{}. The change of state.

[0069] It is understandable that StatelessWidget is a static type of widget, while StatefulWidget is a dynamic type of widget. The state parent components of each application component have two types, one is a component that retains the static type of StatelessWidget, and the other is a component that retains the dynamic type of StatefulWidget. Therefore, the state type of each state parent component is a dynamic type or a static type.

[0070] Step S30, determining all first state parent components whose state types are dynamic types;

[0071] In this embodiment, the first state parent component refers to the state parent component of the application component in the current application object to be adjusted, the state type of which is a dynamic type. For example, the current application component is a GridView Widget, and in the Flutter framework, the default state parent component of the GridView Widget is StatefulWidget. Since StatefulWidget is a dynamic type, this embodiment can determine that the GridView Widget is the first state parent component of the dynamic type according to StatefulWidget.

[0072] Step S40: According to the first state parent component, a second state parent component whose state type is a static type is obtained from a preset database;

[0073] In this embodiment, the difference in the state parent components of the application components will affect the garbage collection of the system during the normal operation of the application object to be adjusted. The specific reason is that the system's garbage collection mechanism stipulates that the system will monitor the state parent components of all application components in real time. Among the state parent components loaded by the current UI interface, if they are no longer displayed in the UI interface due to interactive operations, the first state parent component of the dynamic type will not be recycled by the system in real time, but will remain in the system background and occupy memory resources until the retention time of the first state parent component of the dynamic type is greater than the time threshold specified by the system garbage collection mechanism. The second state parent component of the static type will be recycled directly. Therefore, the garbage collection situation of the system will be affected by the difference in state parent components.

[0074] During the normal operation of the application object to be adjusted in the Flutter framework, the system will continuously recycle the application garbage generated by the application object to be adjusted to release the system running memory. Among the application objects to be adjusted, if the application object uses the dynamic type first state parent component StatefulWidget, according to the system garbage collection mechanism specified by the system, the state parent component in the application object to be adjusted cannot be timely recycled by the system garbage collection mechanism, and thus will remain in the system and occupy the system's precious running memory. StatelessWidget is a static type, stateless state parent component. According to the provisions of the system garbage collection mechanism, the system will recycle the static type second state parent component in real time, thereby releasing the system running memory.

[0075] Therefore, converting the first-state parent component of the dynamic type into the second-state parent component of the dynamic type can enable the system garbage collection mechanism to recycle more application components, avoiding the first-state parent component of the dynamic type from being stranded in the system and consuming the system running memory. The state type of the first-state parent component is a dynamic type, which proves that the state parent component inherited by the current application component is StatefulWidget. Therefore, it is necessary to develop and adjust the first-state parent component StatefulWidget of the dynamic type. The adjustment method is to obtain the second-state parent component of the static type from the preset database. The preset database refers to the component development database in the Flutter framework, which contains various component widgets that can be called in the application object to be adjusted. Since the second-state parent component is a static type, the second-state parent component can only be a StatelessWidget.

[0076] In this embodiment, if the first-state parent component is a dynamic type StatefulWidget, the advantages of the static type StatelessWidget can be known based on the attribute characteristics of the state parent component, so it is necessary to obtain the static type second-state parent component StatelessWidget from the preset database.

[0077] Specifically, the step of acquiring a second state parent component whose state type is a static type from a preset database according to the first state parent component includes:

[0078] Step A1, obtaining component category information of the parent component in the first state;

[0079] Step A2, determining all state inheritance sources in a preset database, and determining a target state inheritance source from all state inheritance sources according to the component category information;

[0080] If the first-state parent component is a dynamic type, it is necessary to obtain the second-state parent component. In this embodiment, there are functional application components of various functional categories, such as GridVieW Widget, ListView or SingleChildScrollView, etc. Different functional application components inherit their respective functional categories, and the state inheritance source refers to two different state parent components of the same functional application component, that is, the state inheritance source of the same functional category has two different state types of state parent components. For example, in the GridVieW Widget, the state inheritance source of the grid view component includes two state parent components, one is the state parent component 1 of the dynamic grid view component that inherits StatefulWidget, and the other is the state parent component 2 of the static type grid view component that inherits StatelessWidget. There are multiple state inheritance sources in the preset database, so it is necessary to determine which state inheritance source the first state parent component comes from based on the component category information of the current first state parent component.

[0081] This embodiment makes a judgment through the component category information of the parent component of the first state. The component category information refers to the component function category of the parent component of the first state, which can identify the functional category to which the current application component belongs. The component function category refers to the functional category corresponding to the component. For example, if the parent component of the first state is GridVieW Widget, then the component category information of GridVieW Widget is the grid view category. According to the grid view category, the target state inheritance source of the grid view category can be obtained from the preset database. The preset database refers to the basic component database of the current Flutter framework, which saves the state parent inheritance sources of various component function categories.

[0082] Step A3: According to the component category information, a second state parent component whose state type is a static type is obtained from the target state inheritance source.

[0083] There are two state parent components saved in the target state inheritance source, one is the state parent component 1 that inherits the component category information of StatefulWidget, and the other is the state parent component 2 that inherits the static type component category information of StatelessWidget. Therefore, the second state parent component with a static state type can be obtained from the target state inheritance source based on the component category information.

[0084] For example, the current component category information is a grid view category. Since the first-state parent component is a dynamic type, it is necessary to obtain the second-state parent component of the static type in the state inheritance source of the grid view category in the preset database.

[0085] Step S50, obtaining the attribute information of the first-state parent component, deleting the first-state parent component, and generating a target adjustment component according to the second-state parent component and the attribute information.

[0086] In this embodiment, the first-state parent component is changed to the second-state parent component, that is, the state parent component in the application component is changed from the dynamic type of the first-state parent component to the static type of the second-state parent component. In this process, there may be some attribute information in the first-state parent component, and these attribute information will be extracted and retained. Because the attribute information may involve the development data of the developer to adjust the application object. For example, the first-state parent component stores the display duration of the UI interface when the component is called, or the interface switching frequency of the UI interface, etc. Therefore, it is necessary to retain the attribute information of the first-state parent component in the second-state parent component, specifically to obtain the attribute information in the first-state parent component of the current application object to be adjusted, delete the first-state parent component, and save the attribute information to the second-state parent component at the same time to generate an updated second-state parent component, and the new state parent component is the target adjustment component. For example, obtain the attribute information of StatefulWidget, delete StatefulWidget, and generate the target adjustment component based on the attribute information and StatelessWidget. It can be understood that the first state parent component and the second state parent component determine the convenience of the application object's application garbage being recycled by the garbage collection mechanism, but do not determine the recycling time and recycling conditions.

[0087] Specifically, the steps of acquiring the attribute information of the first-state parent component, deleting the first-state parent component, and generating a target adjustment component according to the second-state parent component and the attribute information include:

[0088] Step B1, obtaining all first editing attributes of the first state parent component and target attribute information corresponding to the first editing attributes;

[0089] The attribute information includes the first editing attribute and the target attribute information corresponding to the first editing attribute. In this embodiment, the first editing attribute and the target attribute information corresponding to the first editing attribute are called through the dynamic debugging function of the first state parent component. It can be understood that different state parent components have their own debugging functions, and the debugging function can provide function parameter calls for the startup, operation, editing, etc. of the state parent component, and ensure the transfer of all parameters of the state parent component from the development stage to the operation stage. This embodiment obtains the dynamic debugging function of the first state parent component, and the dynamic debugging function ensures that the first state parent component calls all the first editing attributes normally in the application object to be adjusted. The first editing attribute refers to the editable attribute in the first state parent component, such as the size and shape of the component, the background color and texture, etc. The first editing attribute includes the corresponding target attribute information, such as the component has a side length of 1 cm, a red texture, a rectangle, etc. The first editing attribute and the corresponding target attribute information can be obtained according to the dynamic debugging function.

[0090] Step B2, deleting the first state parent component, and obtaining the second editing attribute of the second state parent component;

[0091] Since the parent component of the first state is the object to be adjusted, the parent component of the first state can be deleted, and the second editing attribute of the parent component of the second state is obtained at the same time. The process of obtaining the second editing attribute needs to respond to the static debugging function of the parent component of the second state. The second editing attribute can be called according to the static debugging function. In this embodiment, the second editing attribute has no data by default and needs to be filled with the target editing information in the first editing attribute.

[0092] Step B3: according to the attribute mapping relationship between the first editing attribute and the second editing attribute, the target attribute information is saved in the second editing attribute to generate a target adjustment component.

[0093] Although the state types of the first state parent component and the second state parent component are different, their respective editing properties are exactly the same. In this embodiment, the first editing property of the first state parent component corresponds to the target property information, while the property information of the second editing property of the second state parent component is default and needs to be filled in with the target property information. Since the editing properties of the first editing property and the second editing property are the same, the target property information of the first editing property can be saved in the second editing property through the property mapping relationship between the two, so that the original property information of the first state parent component is transferred to the second state parent component without any change, forming a target adjustment component.

[0094] Specifically, the step of saving the target attribute information into the second editing attribute to generate a target adjustment component includes:

[0095] Step C1, saving the target attribute information into the second edit attribute, and initializing the second edit attribute to obtain a first initialization state;

[0096] Step C2: if the first initialization state is an initialization failure state, obtaining target initialization parameters in the parent component of the first state, and obtaining default initialization parameters in the parent component of the second state;

[0097] Step C3, updating the default initialization parameters to target initialization parameters to generate an updated second-state parent component;

[0098] Step C4, based on the updated second state parent component, initializing the second editing attribute to obtain a second initialization state;

[0099] Step C5: If the second initialization state is an initialization success state, the updated second state parent component is confirmed as a target adjustment component.

[0100] After the target attribute information is saved in the second editing attribute, it is necessary to determine whether the second editing attribute can be successfully initialized according to the target attribute information. Specifically, the second editing attribute can be initialized according to the static debugging function to obtain the first initialization state.

[0101] If the first initialization state is an initialization failure state, it proves that the second edit attribute is initialized abnormally. At this time, the target initialization parameters in the first state parent component are obtained according to the dynamic debugging parameters. The initialization parameters refer to the functional parameters of each state parent component to realize the normal initialization of its attribute information. It can be understood that the target initialization parameters are the parameters for the normal initialization of the first state parent component in the project requirements. Since the second edit attribute in the second state parent component cannot be initialized normally, the target initialization parameters in the first state parent component can be used to replace the default initialization parameters in the second state parent component to generate the updated second state parent component. The second edit attribute in the updated second state parent component is initialized and processed to obtain the corresponding second initialization state.

[0102] If the second initialization state is a successful initialization state, it proves that the target attribute information of the second editing attribute in the updated second state parent component can be initialized normally. At this time, the updated second state parent component can be confirmed as the target adjustment component.

[0103] That is, the normal call of all the second edit properties in the second state parent component can be realized through the static debugging function. Therefore, all the second edit properties can be extracted through the static debugging function. Since the state types of the first state parent component and the second state parent component are different, their editable properties are consistent, so the first edit property and the second edit property have an attribute mapping relationship, such as the size shape in the first edit property corresponds to the size shape in the second edit property, and the two correspond one to one, so it is necessary to save the target attribute information to the second edit property according to the attribute mapping relationship, so as to generate the target adjustment component.

[0104] Furthermore, the step of storing the target attribute information in the second editing attribute to generate a target adjustment component also includes:

[0105] Step C6, saving the target attribute information in the second edit attribute, and obtaining the called state of the updated second state parent component;

[0106] Step C7: if the called state is a calling success state, a target adjustment component is generated according to the updated second state parent component.

[0107] In this embodiment, after the mapping and saving of the target attribute information is completed, it is necessary to perform a link test on the second-state parent component after the target attribute information is changed. The link test process is that the updated second-state parent component calls the target attribute information to which it belongs. If the target attribute information is successfully read and called by the updated second-state parent component, the called state is a call success state, otherwise it is a call failure state. That is, according to the called state, it can be judged whether the updated second-state parent component can be called normally by the application object to be adjusted. If the called state obtained after the link test is a call success state, it means that the target attribute information will not cause the call exception of the updated second-state parent component. On the contrary, the called state is a call failure state, which means that the target attribute information will cause the call exception of the updated second-state parent component. Therefore, whether the updated second-state parent component will have a call exception can be determined by the called state.

[0108] In this embodiment, the static debugging function is an interface function for performing functional operations (such as data editing, parameter calling, component startup or running, etc.) on the second-state parent component. Therefore, in this embodiment, the static debugging function participates in the process of link testing the updated second-state parent component. As an interface function, the updated second-state parent component will call the target attribute information through the static debugging function. If the target attribute information is successfully read and called by the updated second-state parent component, the static debugging function will obtain the return value 1 returned by the updated second-state parent component representing the successful reading call. At this time, the static debugging function will set the called state to the successful calling state; if the target attribute information cannot be successfully read and called by the updated second-state parent component, the static debugging function will obtain the return value 0 returned by the updated second-state parent component representing the failed reading call. At this time, the static debugging function will set the called state to the failed calling state.

[0109] Therefore, through the static debugging function, it can be determined whether the target attribute information of each item in the updated second state parent component will cause the response error of the current updated second state parent component when it is called, that is, whether the target attribute information in the updated second state parent component is successfully called. If the called state is a successful call state, it proves that the target attribute information in the second edit attribute after the current change will not cause the call abnormality of the updated second state parent component. At this time, the target adjustment component is directly generated according to the updated second state parent component.

[0110] The present invention obtains an application object to be adjusted, and obtains all application components of the application object to be adjusted; extracts the state parent component of each application component, and obtains the state type corresponding to each state parent component; determines that all first state parent components have a dynamic state type; obtains a second state parent component with a static state type from a preset database according to the first state parent component; obtains the attribute information of the first state parent component, deletes the first state parent component, and generates a target adjustment component according to the second state parent component and the attribute information. The present invention reduces the number of dynamic type application components developed during the development phase, thereby greatly reducing the number of dynamic type application components running in the system memory, thereby reducing the occupancy rate of the dynamic type application components on the system running memory, ensuring the normal operation of the application, and further improving the data processing capability of the application to improve the application running efficiency.

[0111] Further, based on the first embodiment, a second embodiment of the component adjustment method of the present invention is proposed. In this embodiment, after the step of changing the first-state parent component to the second-state parent component to generate a target adjustment component, the step further includes:

[0112] Step a, obtaining the first nested call state of the target adjustment component;

[0113] In this embodiment, since different application components may call each other in nested ways, after generating the target adjustment component, it is necessary to determine whether the target adjustment component can be normally called by other application components. In this embodiment, the static debugging function can perform a nested call test on each component of the target adjustment component, that is, test whether the target adjustment component is successfully called by other components to obtain the first nested call state, thereby determining whether other components can normally call the target adjustment component.

[0114] Step b: if the first nested call state is a call failure state, obtaining component nesting association parameters of the first state parent component, and obtaining default nesting association parameters of the target adjustment component;

[0115] Step c, updating the default nested association parameters to component nested association parameters, and deleting the default nested association parameters to generate a new target adjustment component;

[0116] The default nested association parameters in the target adjustment component are used by default in the static debugging function. If the first nested call state is a call failure state, it proves that the current target adjustment component cannot be called normally by other components. At this time, the component nested association parameters in the first state parent component are obtained according to the dynamic debugging function. The component nested association parameters are the transfer parameters for the first state parent component to be normally called by other application components in the project requirements. Therefore, the default nested association parameters can be deleted and replaced with component nested association parameters, that is, the component nested association parameters are updated to the target adjustment component to generate a new target adjustment component.

[0117] Step d, obtaining a second nested call state of the new target adjustment component;

[0118] Step e: if the second nested call state is a call failure state, output a prompt message of component call exception.

[0119] The new target adjustment component is nested and tested again to obtain the second nested call status of the new target adjustment component. If the second nested call status is still a call failure status, it proves that the component nesting associated parameters are unavailable parameters, the current target adjustment component cannot be called normally by other components, and the normal nested call of the component cannot be realized. At this time, it is necessary to output a prompt message of component call exception to the developer.

[0120] Further, based on the first embodiment, a third embodiment of the component adjustment method of the present invention is proposed. In this embodiment, after the step of generating a target adjustment component according to the second state parent component and the attribute information, the step further includes:

[0121] Step f, running the application object to be adjusted, and recording the memory usage of each target adjustment component in the application object to be adjusted;

[0122] Step g, obtaining the target calling frequency of each target adjustment component within a preset time based on the memory occupancy;

[0123] After the target adjustment component is generated, the memory usage of different target adjustment components in the application object to be adjusted during operation can be recorded. If the target adjustment component is recycled by the garbage collection mechanism after occupying the memory for a period of time, the running memory occupied by the target adjustment component will be released. According to the memory usage, the target call frequency of each target adjustment component within the preset time can be obtained. The target call frequency represents the number of times the current target adjustment component is called within the preset time. The target call frequency reflects whether the target adjustment component is frequently called within the preset time. It can be understood that the higher the target call frequency, the more times the target adjustment component is called within the preset time. Conversely, the lower the target call frequency, the fewer times the target call component is called within the preset time. The preset time can be 1 day, 5 days, a week, and so on.

[0124] Step h, determining, from each target adjustment component, all high-frequency application components whose target call frequency is greater than a first frequency threshold;

[0125] Step i: output the target calling frequency of the high-frequency application component.

[0126] If there are high-frequency application components that are frequently called during operation, that is, the target call frequency is greater than the first frequency threshold, then the target adjustment component using the second-state parent component may cause the high-frequency application component to be frequently recycled and released, which will cause the application to start slowly and become stuck. That is, in the development process of high-frequency application components, the recycling efficiency and data processing efficiency of the garbage collection mechanism are overemphasized, while the application startup efficiency is ignored. Therefore, it is necessary to perform performance tuning on the high-frequency application components, that is, the high-frequency application components can be developed again, for example, taking into account the performance tuning development plan in the next version of the application. In this embodiment, the target call frequency of the high-frequency application components is sorted out to generate a high-frequency component development report and output it to the developer. In the future, the developer will conduct comparative analysis and carry out subsequent development and maintenance of the high-frequency application components.

[0127] Furthermore, after the step of obtaining the target calling frequency of each target adjustment component within a preset time based on the memory occupancy, the method further includes:

[0128] Step j, determining, from each target adjustment component, all low-frequency application components whose target call frequency is less than a second frequency threshold;

[0129] Step k: output the target calling frequency of the low-frequency application component.

[0130] If a low-frequency application component whose target call frequency is less than the second frequency threshold is detected during operation, it proves that the current low-frequency application component has a very low call frequency and can be used as a priority object for the system garbage collection mechanism. Therefore, the target call frequency of the low-frequency application component can be arranged in frequency levels from small to large to generate a component level development report, which sorts the application components by target call frequency from small to large. The lower the target call frequency, the lower the interaction frequency of its component call. In this way, the developer can set it as a priority recycling object in the subsequent development and maintenance process of the low-frequency application component, thereby avoiding unnecessary occupation of the system running memory.

[0131] In addition, an embodiment of the present invention also proposes a device, which includes: a memory 109, a processor 110, and a component development program stored in the memory 109 and executable on the processor 110, wherein the component development program implements the steps of each embodiment of the above-mentioned component adjustment method when executed by the processor 110.

[0132] In addition, the present invention also provides a computer storage medium, which stores a component development program. The component development program can also be executed by a processor to implement the steps of each embodiment of the above-mentioned component adjustment method.

[0133] The expanded contents of the specific implementation modes of the device and computer storage medium of the present invention are basically the same as the embodiments of the above-mentioned component adjustment method, and will not be elaborated here.

[0134] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0135] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0136] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0137] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A component adjustment method, characterized in that: The component adjustment method comprises: Acquire the application object to be adjusted, and acquire all application components of the application object to be adjusted; Extract the state parent component of each application component, and obtain the state type corresponding to each state parent component; Determine the first state parent component of all state types that are dynamic types; According to the first state parent component, a second state parent component whose state type is a static type is obtained from a preset database; Acquire the attribute information of the parent component in the first state, delete the parent component in the first state, and generate a target adjustment component according to the parent component in the second state and the attribute information; The step of obtaining the attribute information of the first-state parent component, deleting the first-state parent component, and generating a target adjustment component according to the second-state parent component and the attribute information includes: obtaining all first editing attributes of the first-state parent component and target attribute information corresponding to the first editing attributes; deleting the first-state parent component, and obtaining the second editing attributes of the second-state parent component; and saving the target attribute information in the second editing attributes according to the attribute mapping relationship between the first editing attributes and the second editing attributes to generate a target adjustment component; The step of saving the target attribute information into the second editing attribute to generate a target adjustment component includes: saving the target attribute information into the second editing attribute, and initializing the second editing attribute to obtain a first initialization state; if the first initialization state is an initialization failure state, obtaining the target initialization parameters in the first state parent component, and obtaining the default initialization parameters in the second state parent component; updating the default initialization parameters to the target initialization parameters to generate an updated second state parent component; based on the updated second state parent component, initializing the second editing attribute to obtain a second initialization state; if the second initialization state is an initialization success state, confirming the updated second state parent component as the target adjustment component.

2. The component adjustment method according to claim 1, characterized in that: The step of obtaining a second state parent component whose state type is a static type from a preset database according to the first state parent component includes: Obtain component category information of the parent component of the first state; Determine all state inheritance sources in a preset database, and determine a target state inheritance source from all state inheritance sources according to the component category information; According to the component category information, a second state parent component whose state type is a static type is obtained from the target state inheritance source.

3. The component adjustment method according to claim 1, characterized in that: The step of storing the target attribute information in the second editing attribute to generate a target adjustment component also includes: The target attribute information is saved in the second edit attribute, and the called state of the updated second state parent component is obtained; If the called state is a calling success state, a target adjustment component is generated according to the updated second state parent component.

4. The component adjustment method according to claim 1, characterized in that: After the step of generating a target adjustment component according to the second state parent component and the attribute information, the following step further includes: Obtaining a first nested call state of the target adjustment component; If the first nested call state is a call failure state, obtaining component nesting association parameters of the first state parent component, and obtaining default nesting association parameters of the target adjustment component; Updating the default nested association parameters to component nested association parameters, and deleting the default nested association parameters to generate a new target adjustment component; Obtaining a second nested call state of the new target adjustment component; If the second nested call state is a call failure state, a prompt message indicating component call exception is output.

5. The component adjustment method according to claim 1, characterized in that: After the step of generating a target adjustment component according to the second state parent component and the attribute information, the following step further includes: Running the application object to be adjusted, and recording the memory usage of each target adjustment component in the application object to be adjusted; Based on the memory usage, obtain the target calling frequency of each target adjustment component within a preset time; Determine, from each target adjustment component, all high-frequency application components whose target call frequency is greater than a first frequency threshold; The target calling frequency of the high-frequency application component is output.

6. The component adjustment method according to claim 5, characterized in that: After the step of obtaining the target calling frequency of each target adjustment component within a preset time based on the memory occupancy, the following step further includes: Determine, from each target adjustment component, all low-frequency application components whose target call frequency is less than a second frequency threshold; The target calling frequency of the low-frequency application component is output.

7. A device, characterized in that: The device comprises: a memory, a processor, and a component development program stored in the memory and executable on the processor, wherein the component development program implements the steps of the component adjustment method according to any one of claims 1 to 6 when executed by the processor.

8. A computer storage medium, characterized in that The computer storage medium stores a component development program, and when the component development program is executed by a processor, the steps of the component adjustment method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Component architecture

    CN101248416A

  • Dynamic componentization implementation method, device and equipment, and storage medium

    CN108804197A