Application optimization method and apparatus supporting the same

Provided is an application optimization method and an electronic device supporting the same. According to an example embodiment, the application optimization method may include: determining whether a condition set with respect to a duration of an idle state of the electronic device is satisfied, selecting an application for which application optimization is to be performed based on an application usage record of a user of the electronic device in response to the set condition being satisfied, and generating an optimized application by performing the application optimization in the background for the selected application.

BACKGROUND

The disclosure relates to an application optimization technique.

2. Description of Related Art

Due to development of computing systems, many application programs (hereinafter, applications) that operate in an electronic device, such as a smart phone, are being produced. Such applications may be configured as a plurality of code for achieving a predetermined purpose, and may be packaged and distributed. When an application is installed in an electronic device, the code written in a programming language may be converted into code for a platform supported by the electronic device, and the converted code may be used as a set of instructions to achieve the predetermined purpose. For example, in an electronic device to which an Android operating system is applied, the code of the application may be compiled to fit a runtime environment and converted into native code. As a compiling scheme for code, an ahead-of-time (AOT) scheme, a just-in-time (JIT) scheme, or a hybrid scheme in which the AOT scheme and the JIT scheme are mixed may be used.

When firmware is updated through an over-the-air (OTA) scheme or a setting value is initialized through a factory reset, a compiler filter of the application may be set to a predetermined value, and overall performance of the application including execution of the application may decrease. In addition, in a hybrid scheme, since the code of the application can be compiled when a predetermined condition (e.g., a charged state, an idle state, or a state in which a designated time, such as once a day, has arrived) is satisfied, there is no choice but to wait until the predetermined condition is satisfied in order to improve the performance of the application.

SUMMARY

Embodiments of the disclosure may provide a method and an apparatus supporting the method of performing optimization in application units by selecting an application to be optimized based on an application usage pattern of a user and compiling code.

According to an example embodiment, an application optimization method may include: determining whether a condition set with respect to a duration of an idle state of an electronic device is satisfied, selecting an application for which application optimization is to be performed based on an application usage record of a user of the electronic device in response to the set condition being satisfied, and generating an optimized application by performing the application optimization in the background for the selected application.

According to an example embodiment, an electronic device configured to support an application optimization method may include: at least one processor, and at least one memory configured to store instructions and an application to be executed by the processor, wherein when the instructions configured to be executed by the processor, the processor may be configured to: determine whether a condition set with respect to a duration of an idle state of the electronic device is satisfied, select an application to perform application optimization based on an application usage record of a user of the electronic device in response to the set condition being satisfied, and generate an optimized application by performing the application optimization in the background for the selected application.

According to various example embodiments of the disclosure, by optimization in application units being performed, application optimization may be performed even if an idle time of an electronic device is short.

According to various example embodiments of the disclosure, a frequently used application may be preferentially optimized by selecting an application to be optimized based on an application usage pattern of a user and performing application optimization accordingly.

DETAILED DESCRIPTION

Hereinafter, various example embodiments will be described in greater detail with reference to the accompanying drawings. When describing the example embodiments with reference to the accompanying drawings, like reference numerals refer to like elements and any repeated description related thereto will be omitted.

The program140may be stored as software in the memory130, and may include, for example, an operating system (OS)142, middleware144, or an application146.

The haptic module179may convert an electric signal into a mechanical stimulus (e.g., a vibration or a movement) or an electrical stimulus which may be recognized by a user via his or her tactile sensation or kinesthetic sensation. According to an example embodiment, the haptic module179may include, for example, a motor, a piezoelectric element, or an electric stimulator.

The camera module180may capture a still image and moving images. According to an example embodiment, the camera module180may include one or more lenses, image sensors, image signal processors, or flashes.

The power management module188may manage power supplied to the electronic device101. According to an example embodiment, the power management module188may be implemented as, for example, at least a part of a power management integrated circuit (PMIC).

The battery189may supply power to at least one component of the electronic device101. According to an example embodiment, the battery189may include, for example, a primary cell which is not rechargeable, a secondary cell which is rechargeable, or a fuel cell.

FIG.2is a block diagram200illustrating an example configuration of a program140according to various embodiments. According to an example embodiment, the program140may include an OS142to control one or more resources of the electronic device101, middleware144, or an application146executable in the OS142. The OS142may include, for example, Android™, iOS™, Windows™, Symbian™, Tizen™, or Bada™. At least part of the program140, for example, may be pre-loaded on the electronic device101during manufacture, or may be downloaded from or updated by an external electronic device (e.g., the electronic device102or104, or the server108) during use by a user.

The OS142may control management (e.g., allocation or deallocation) of one or more system resources (e.g., a process, a memory, or a power source) of the electronic device101. The OS142may additionally or alternatively include other one or more driver programs to drive other hardware devices of the electronic device101, for example, the input module150, the sound output module155, the display module160, the audio module170, the sensor module176, the interface177, the haptic module179, the camera module180, the power management module188, the battery189, the communication module190, the SIM196, or the antenna module197.

The middleware144may provide various functions to the application146such that a function or information provided from one or more resources of the electronic device101may be used by the application146. The middleware144may include, for example, an application manager201, a window manager203, a multimedia manager205, a resource manager207, a power manager209, a database manager211, a package manager213, a connectivity manager215, a notification manager217, a location manager219, a graphic manager221, a security manager223, a telephony manager225, or a voice recognition manager227.

The application manager201may, for example, manage the life cycle of the application146. The window manager203, for example, may manage one or more graphical user interface (GUI) resources that are used on a screen. The multimedia manager205, for example, may identify one or more formats to be used to play media files, and may encode or decode a corresponding one of the media files using a codec appropriate for a corresponding format selected from the one or more formats. The resource manager207, for example, may manage the source code of the application146or a memory space of the memory130. The power manager209, for example, may manage the capacity, temperature, or power of the battery189, and may determine or provide related information to be used for the operation of the electronic device101based on at least in part on corresponding information of the capacity, temperature, or power of the battery189. According to an example embodiment, the power manager209may interwork with a basic input/output system (BIOS) (not shown) of the electronic device101.

The database manager211, for example, may generate, search, or change a database to be used by the application146. The package manager213, for example, may manage installation or update of an application that is distributed in the form of a package file. The connectivity manager215, for example, may manage a wireless connection or a direct connection between the electronic device101and the external electronic device. The notification manager217, for example, may provide a function to notify a user of an occurrence of a specified event (e.g., an incoming call, a message, or an alert). The location manager219, for example, may manage location information on the electronic device101. The graphic manager221, for example, may manage one or more graphic effects to be offered to a user or a user interface related to the one or more graphic effects.

The security manager223, for example, may provide system security or user authentication. The telephony manager225, for example, may manage a voice call function or a video call function provided by the electronic device101. The voice recognition manager227, for example, may transmit a user's voice data to the server108, and may receive, from the server108, a command corresponding to a function to be executed on the electronic device101based at least in part on the voice data, or text data converted based at least in part on the voice data. According to an example embodiment, the middleware144may dynamically delete some existing components or add new components. According to an example embodiment, at least part of the middleware144may be included as part of the OS142or may be implemented as another software separate from the OS142.

The application146may include, for example, a home251, dialer253, short message service (SMS)/multimedia messaging service (MMS)255, instant message (IM)257, browser259, camera261, alarm263, contact265, voice recognition267, email269, calendar271, media player273, album275, watch277, health279(e.g., for measuring the degree of workout or biometric information, such as blood sugar), or environmental information281(e.g., for measuring air pressure, humidity, or temperature information) application. According to an example embodiment, the application146may further include an information exchanging application (not shown) that is capable of supporting information exchange between the electronic device101and the external electronic device. The information exchange application, for example, may include a notification relay application adapted to transfer designated information (e.g., a call, message, or alert) to the external electronic device or a device management application adapted to manage the external electronic device. The notification relay application may transfer notification information corresponding to an occurrence of a specified event (e.g., receipt of an email) at another application (e.g., the email application269) of the electronic device101to the external electronic device. Additionally or alternatively, the notification relay application may receive notification information from the external electronic device and provide the notification information to a user of the electronic device101.

The device management application may control a power source (e.g., turning on or off) or a function (e.g., brightness, resolution, or focus) of an external electronic device that communicates with the electronic device101or a portion of components of the external electronic device (e.g., a display module or a camera module). The device management application may additionally or alternatively support installation, deletion, or update of an application that operates in an external electronic device.

FIG.3is a block diagram illustrating an example configuration of an example electronic device supporting an application optimization method according to various embodiments, andFIG.4is a diagram illustrating an example compiler filter of an application according to various embodiments.

Referring toFIG.3, an electronic device300(e.g., the electronic device101ofFIG.1) according to an example embodiment may include a processor (e.g., including processing circuitry)305(e.g., the processor101ofFIG.1) and a memory310(e.g., the memory130ofFIG.1), and may support an application optimization method. The memory310may store various data used by the processor305of the electronic device300. The various data may include, for example, software (e.g., the program140ofFIG.1) and input data or output data for a command related thereto.

A program may be stored as software in the memory310, and may include, for example, an OS (e.g., the OS142ofFIG.1), middleware (e.g., the middleware144ofFIG.1) or an application (e.g., the application146ofFIG.1).

An application may be configured as a plurality of code for achieving a predetermined purpose, and may be packaged and distributed. When an application is installed in the electronic device300, code written in programming language may be converted into code for a platform supported by the electronic device300, and the converted code may be used as a set of instructions to achieve a predetermined purpose.

For example, and without limitation, in the electronic device300to which an Android operating system is applied, the processor305may compile code of the application to fit a runtime environment and convert the code into native code. As a compiling scheme for the code, for example, and without limitation, an ahead-of-time (AOT) scheme, a just-in-time (JIT) scheme, or a hybrid scheme in which an AOT scheme and a JIT scheme are mixed may be used.

The AOT scheme may compile and convert the code into executable code and store the converted code when the application is installed, and then directly read the executable code that is converted when the application is executed. In the AOT scheme, since the code is converted into executable code when the application is being installed, less time may be required to execute the application, but more time may be required to install the application and more storage space may be required to install the application.

The JIT scheme may be a scheme of compiling only necessary code among code at an appropriate time when an application is executed. In the JIT scheme, when repetitive execution is detected while an interpreter scheme for a loaded class among the code is being performed, a JIT compiler may be appropriately operated to improve execution speed. In the JIT scheme, the executable code may be executed very quickly, and since the memory310comprises cache by default, performance may be maximized and/or improved when a class is repeatedly called. However, in the JIT scheme, since the code is compiled into the executable code during runtime, less time may be required to install the application but much more time may be required to execute the application. In addition, when the code cached in the memory310is released and re-execution of the code is detected, it may take time for the code to be re-converted, which may cause a delay in an operation of the application.

In the hybrid scheme, when an application is installed, the JIT scheme may be used to shorten the installation time of the application and reduce the installation space of the application. When an AOT daemon is started after a profile according to an application usage pattern of a user is stored through an interpreter, the application is compiled in the background to generate executable code, and when the application is executed, the execution time may be shortened by directly using the executable code.

In the electronic device300to which the Android operating system is applied, an execution environment called Android Runtime (hereinafter, ART) may be supported. ART may use the hybrid scheme. In ART, a tool called dex2oat is used to compile a Dalvik executable (.dex) file (a set of code) of an application, wherein an operating scheme may be designated by a set value of a compiler filter400, and the compiler filter400may be set based on a profile according to an application usage pattern of the user. In ART, code of the application may be compiled according to the set compiler filter400.

Referring toFIG.3, the processor305of the electronic device300according to an example embodiment may include various processing circuitry and control at least one other component and may perform various data processing or operations. In the electronic device300, the AOT daemon and ART may be implemented in a form of a program or instruction stored in the memory310. An instruction may be executed by the processor305, and the processor305may perform a function corresponding to the instruction.

The processor305may compile a .dex file existing in an .apk file, which is a package form of an application, using the dex2oat tool through the AOT daemon. The .dex file compiled through the AOT daemon may be output as an .oat file. A size of the .oat file may be different depending on the compiler filter400used during compilation, and performance of the application may also be different.

In the electronic device300to which the Android operating system is applied, a firmware update may be performed in a firmware over-the-air (FOTA) scheme. When firmware is updated or a setting value is initialized through a factory reset, the compiler filter400of the application may be set to a first option (e.g., verify), and overall performance of the application including execution of the application may decrease. In addition, in the hybrid scheme, since the code of the application can be compiled when a predetermined condition (e.g., a charged state, an idle state, or a state in which a designated time such as once a day has arrived) is satisfied, there is no choice but to wait until the predetermined condition is satisfied to improve the performance of the application.

According to an example embodiment, the processor305of the electronic device300may select an application to be optimized based on the application usage record of the user, and may compile code of the selected application in the background to perform optimization in application units according to the compiler filter400set based on the profile for the selected application.

As shown inFIG.4, the compiler filter400may include an option to compile a .dex file (e.g., application code). For example, when the compiler filter400is set to “verify”, only code verification of the .dex file may be performed, and when the compiler filter400is set to “quicken”, code verification of the .dex file may be performed and a portion of .dex instructions may be optimized, and when the compiler filter400is set to “speed-profile”, code verification of the .dex file may be performed and a method in the profile may be AOT-compiled, and when the compiler filter400is set to “speed”, code verification of the .dex file may be performed and all methods may be AOT-compiled.

As the compiler filter400goes in a downward direction (direction from “verify” to “speed”) of the table shown inFIG.4, a size of an .oat file resulting from compilation may increase, while performance of an application may be improved. As the compiler filter400goes in an upward direction (direction from “speed” to “verify”) of the table shown inFIG.4, the size of the .oat file resulting from compilation may decrease, while performance of the application may degrade.

Application optimization in the electronic device300may be performed by setting the compiler filter400based on a profile according to an application usage pattern and compiling code of the application according to the set compiler filter400.

In an example embodiment, the processor305may generate a list of candidate applications to which a priority is assigned based on an application usage record of a user in order to select an application to perform application optimization, and according to the priority of the list, may determine whether optimization is possible for at least one candidate application.

The processor305may determine whether the optimization is possible for the application through ART. In an example embodiment, the processor305may determine whether the optimization is possible for the at least one candidate application based on the profile according to the user pattern through ART. The processor305may determine whether there is a method to optimize based on the profile of the at least one candidate application, and if there is a method to optimize, determine that the at least one candidate application can be optimized.

Based on a result of the determining, the processor305may select a candidate application having a highest priority from among the at least one candidate application that can be optimized as the application for which application optimization is to be performed, and perform the application optimization.

The processor305may set the compiler filter400for the selected application to a second option (e.g., “speed-profile” or “speed”). The processor305may perform the application optimization by compiling an application selected as the application to optimize according to the set compiler filter400. An optimized application may be generated by performing the application optimization.

According to the electronic device300of an example embodiment, even if an idle time of the electronic device300is not long enough for optimization to be performed for all applications, the processor305may perform the optimization for each application by performing the optimization in application units. According to the electronic device300of an example embodiment, a frequently used application may be preferentially optimized by selecting an application to be optimized based on an application usage record of a user.

Hereinafter, an application optimization method performed in an electronic device according to an example embodiment is described in greater detail with reference toFIG.5.

FIG.5is a diagram illustrating an example application optimization method according to various embodiments.

In the electronic device300to which the Android operating system is applied, a firmware update may be performed in a FOTA scheme. When firmware is updated or a setting value is initialized through a factory reset, the compiler filter400of an application may be set to a predetermined value (e.g., verify), and overall performance of the application, including execution of the application, may decrease, and application optimization may be needed to increase the performance of the application.

The application optimization may be performed in the background, and may be performed when a state of the electronic device300is determined and a set condition is satisfied in order to minimize and/or reduce impact on an operation of the application running in the foreground.

Referring toFIG.5, in operation505, the processor305of the electronic device300may determine whether the state of the electronic device300satisfies a set condition in order to minimize and/or reduce impact on an operation of the application running in the foreground. In an example embodiment, when an idle state of the electronic device300is maintained for a set time, the processor305may determine that the set condition is satisfied.

For example, when a display of the electronic device300is turned off, the processor305may determine that the electronic device300is in the idle state. When the display of the electronic device300is turned off, the processor305may generate a task to be performed when the set time elapses in operation510. The task may include operations510,515,520, and525. However, this is only an example embodiment, and whether an electronic device enters an idle state may be determined regardless of whether the display is on or off, and the set condition may be a condition set with respect to a duration of the idle state.

When the set condition is satisfied, in operation515, the processor305may generate a list of candidate applications for which application optimization may be performed. The list of applications may be newly generated and updated whenever operation515is performed. The processor305may generate a list of candidate applications to which ranks are assigned in an order of frequency of use during a set period based on an application usage record of a user.

In operation520, the processor305may determine whether application optimization is possible for at least one candidate application among the candidate applications included in the list. The processor305may identify whether there is a method to optimize for the corresponding candidate application based on a profile of the at least one candidate application, and determine whether optimization is possible based on the identifying.

The processor305may perform the application optimization based on a result of the determining of whether the optimization is possible, and may select a candidate application having a highest priority.

In operation525, the processor305may perform application optimization for the selected application. The application optimization may be performed by setting the compiler filter400based on a profile according to an application usage pattern and compiling the code of the application according to the set compiler filter400.

When the application optimization for the selected candidate application is completed, the processor305may determine whether the electronic device300is still in the idle state, and if the electronic device300is in the idle state, the processor305may repeat an operation of generating a task for application optimization, generating a list of candidate applications, and determining whether optimization is possible, to perform the application optimization. The task, for example, may include operations515,520, and525. When operations510,515,520, and525are repeated while the electronic device300is still in the idle state, operation515may be performed without determining whether the set time in operation510has elapsed. In an example embodiment, operations510,515,520, and525may be performed periodically.

Hereinafter, an application optimization method according to an example embodiment is described in greater detail with reference toFIG.6.

FIG.6is a flowchart illustrating an example application optimization method according to various embodiments. In the application optimization method according to an example embodiment, it may be determined whether the electronic device300satisfies a set condition, and if the condition is satisfied, application optimization may be performed.

Referring toFIG.6, the set condition may include conditions for a duration of an idle state of the electronic device300and whether there is a history of application optimization being performed for all applications. It may be determined whether the electronic device300has entered an idle state such that application optimization may be performed while a user is not using the electronic device300. If there is a history of application optimization being performed for all applications, it may not be necessary to perform the application optimization again. A condition with respect to the history of optimization performed may be determined to verify whether it is necessary to perform the application optimization.

In operation605, the electronic device300may enter the idle state. According to an example embodiment, in operation610, the processor305of the electronic device300may determine whether the idle state of the electronic device300continues for a set time as one of the set conditions. In operation605, if the user uses the electronic device300again after the electronic device300enters the idle state, the idle state may not be maintained for the set time. In such case, if application optimization is performed, performance of the electronic device300may be affected, so the processor305may not perform application optimization to prevent and/or reduce the performance of the electronic device300from being affected.

According to an example embodiment, in operation615, the processor305of the electronic device300may verify whether there is no history of optimization being performed for all applications, as another one of the set conditions. When there is a history of optimization being performed for all applications after firmware is updated using FOTA or after the electronic device300is initialized, the processor305may not perform application optimization because optimization of all applications has already been completed.

When the idle state of the electronic device300continues for the set time and optimization of all applications is not performed after firmware is updated through FOTA or after the electronic device300is initialized, in operation620, the processor305may generate a list of candidate applications to which a priority is assigned based on an application usage record.

In an example embodiment, the priority assigned to the candidate applications may be assigned based on the application usage time for the set period, and the longer the usage time for the set period is, the higher the assigned priority may be. However, this is only an example embodiment, and a priority may be assigned according to other criteria based on usage records. For example, the higher a frequency of use of the application is during the set period, the higher the assigned priority may be.

In operation625, the processor305may determine whether optimization is possible for at least one candidate application in the list. The processor305may determine whether the optimization of the at least one candidate application is possible based on a profile of the corresponding application. This will be described with reference toFIG.7below.

In operation630, the processor305may select an application that can be optimized and has a highest priority from among the candidate applications. In operation635, the processor305may perform application optimization in the background for the selected application.

Hereinafter, operations625and630are described in greater detail with reference toFIG.7.

FIG.7is a flowchart illustrating an example operation of selecting an application for which application optimization is to be performed in an application optimization method according to various embodiments.

Referring toFIG.7, the processor305of the electronic device300according to an example embodiment may determine whether optimization is possible for at least one candidate application in order to select an application for which application optimization is to be performed from among candidate applications.

In operation705, the processor305may select a candidate application having a highest priority from a list of candidate applications generated in operation620. In operation710, the processor305may verify whether the application optimization is performed for the selected candidate application after an update using FOTA. Whether the application optimization has been performed for the candidate application may be verified through the compiler filter400for the candidate application. When the application optimization has not been performed, the compiler filter400may be initialized and set to a first option (e.g., verify) when firmware is updated, and when the application optimization has been performed, the compiler filter400may be changed and set to a second option (e.g., “speed-profile” or “speed”). When the compiler filter400is set to the first option, the processor305may determine that the application optimization has not been performed, and when the compiler filter400is set to the second option, may determine that the application optimization has been performed.

When it is determined that the selected candidate application has been optimized in operation710, the processor305may select a candidate application of a next priority from the list in operation715, and determine whether the application has been optimized in operation710again.

When it is determined that application optimization has not been performed for the selected candidate application in operation710, the processor305may determine whether there is a method to optimize based on a profile of the selected candidate application in operation720. The profile may include index information on frequently called methods, and the processor305may determine that there is a method to optimize when there are methods included in the profile.

When it is determined in operation720that there is no method to optimize in the candidate application, the processor305may select a candidate application of a next priority in operation715, and perform operations710and720.

When it is determined in operation720that there is a method to optimize in the candidate application, the processor305may select the corresponding candidate application as an application for which application optimization is to be performed in operation725.

The processor305may perform application optimization in operation635for the application selected in operation725. The processor305may perform the application optimization by AOT-compiling methods included in the profile of the selected application. In this case, the processor305may set the compiler filter400for the selected application to the second option (e.g., “speed-profile” or “speed”) and perform AOT compilation. The processor305may generate an optimized application through the AOT compilation. The optimized application may have higher performance than that of an application compiled according to the first option (e.g., “verify”).

When the application optimization is performed for all applications, the application optimization method according to an example embodiment may not be performed any more. When the electronic device is initialized or a firmware update is performed through FOTA after the application optimization is performed for all applications, the application optimization method according to an example embodiment may be performed again.

Since the application optimization method according to an example embodiment may be repeated in application units, even if the idle time of the electronic device300is not long enough for optimization to be performed on all applications, it may be guaranteed that the application optimization may be performed at least one application. According to the electronic device300of an example embodiment, an application to be optimized may be selected based on an application usage record of a user to preferentially optimize a frequently used application, and thereby increase user-sensible performance of the electronic device300.

In another example embodiment, the processor305may predict a duration of an idle state of the electronic device based on a usage record of the electronic device. For example, the usage record of the electronic device may include information such as a time the user turns on/off a display of the electronic device and an application that the user has executed. The processor305may predict the duration of the idle state of the electronic device based on statistics on the usage record or may predict the duration of the idle state of the electronic device through machine learning of the usage record.

The processor305may estimate a time required to generate an optimized application by performing application optimization on the application selected in operation630. The required time may be estimated, for example, based on the number of methods included in the profile.

The processor305may perform operation635when the required time that is estimated is longer than a time for which the electronic device is expected to remain in the idle state.

Hereinafter, a method of minimizing and/or reducing inconvenience to the user when the electronic device300leaves the idle state while application optimization is being performed is described in greater detail with reference toFIG.8.

FIG.8is a flowchart illustrating an example operation of adjusting processor affinity when an electronic device leaves an idle state while application optimization is being performed, according to various embodiments.

According to an application optimization method of an example embodiment, the electronic device300may leave the idle state while operations605to635are being performed. For example, the user may turn on a display of the electronic device300to execute an application in the foreground.

When the electronic device300leaves the idle state while operations605to630are being performed, the processor305of the electronic device300according to an example embodiment may suspend the corresponding operation to prevent and/or reduce performance degradation of the application being executed in the foreground.

In operation805, the electronic device300may leave the idle state while an application optimization in operation635is being performed. Since the application optimization in operation635may include an AOT compilation operation, if application optimization is stopped mid-operation, an error may occur when the application is executed later.

When the electronic device300leaves the idle state while the application optimization is being performed in operation635, the processor305may adjust processor affinity for an application optimization operation in operation810to minimize and/or reduce impact on the performance of the application being executed in the foreground. The processor305may dynamically adjust the processor affinity for the application optimization operation according to whether the electronic device300is in the idle state while the application optimization is being performed.

For example, the processor305may include a high-performance core processor with relatively high power consumption and a low-performance core processor with relatively low power consumption. When the electronic device300leaves the idle state while the application optimization is being performed, the processor305may adjust the processor affinity so that the application optimization operation is performed by the low-performance core processor. When the electronic device300enters the idle state again, the processor305may adjust the processor affinity so that the application optimization operation is performed by the high-performance core processor.

According to an example embodiment, an application optimization method may include: determining whether a condition set with respect to a duration of an idle state of an electronic device is satisfied, selecting an application for which application optimization is to be performed based on an application usage record of a user of the electronic device based on the set condition being satisfied, and generating an optimized application by performing the application optimization in the background for the selected application.

The selecting may include, generating a list of candidate applications to which a priority is assigned based on the application usage record of a user based on the set condition being satisfied, determining whether optimization is possible for at least one candidate application in the list based on the priority, and based on a result of the determining, selecting a candidate application having a highest priority from among the at least one candidate application that can be optimized as the application for which the application optimization is to be performed.

The generating of the list may include generating a list of candidate applications to which the priority is assigned based on a usage time of applications for a set period.

The determining of whether the optimization is possible may include verifying whether the at least one candidate application is optimized, determining whether there is a method to be optimized in the at least one candidate application based on the at least one candidate application not being optimized, and determining that the at least one candidate application can be optimized based on there being a method to be optimized.

Based on the idle state of the electronic device being maintained for a set time, the set condition may be satisfied.

Based on the idle state of the electronic device being maintained for the set time and there being no history of application optimization being performed for all applications of the electronic device, the set condition may be satisfied.

According to an example embodiment, the application optimization method may include: dynamically adjusting processor affinity of the electronic device based on the electronic device leaving the idle state while the generating of the optimized application is being performed.

Based on optimization being completed for all applications that can be optimized, the method may be performed again after a firmware update of the electronic device.

According to an example embodiment, the application optimization method may further include: predicting a duration of the idle state based on the usage record of the electronic device, and estimating a time required to generate the optimized application, wherein the generating of the optimized application may be performed based on the predicted time being longer than the estimated time.

The determining, the selecting, and the generating may be performed periodically.

The generating may include setting a compiler filter and compiling the method to be optimized based on the set compiler filter.

According to an example embodiment, an electronic device configured to support an application optimization method may include at least one processor, and at least one memory storing instructions and an application to be executed by the processor, wherein based on the instructions being executed by the processor, the processor305may be configured to: determine whether a condition set with respect to a duration of an idle state of the electronic device is satisfied, select an application to perform optimization based on an application usage record of the electronic device based on the set condition being satisfied, and generate an optimized application by performing the application optimization in the background for the selected application.

The selecting may include, generating a list of candidate applications to which a priority is assigned based on the application usage record based on the set condition being satisfied, determining whether optimization is possible for at least one candidate application in the list based on the priority, and based on a result of the determining, selecting a candidate application having a highest priority from among the at least one candidate application that can be optimized as the application for which the application optimization is to be performed.

The generating of the list may include generating a list of candidate applications to which the priority is assigned based on a usage time of applications for a set period.

The determining of whether the optimization is possible may include verifying whether the at least one candidate application is optimized, determining whether there is a method to be optimized in the at least one candidate application based on the at least one candidate application not being optimized, and determining that the at least one candidate application can be optimized based on there being a method to be optimized.

Based on the idle state of the electronic device being maintained for a set time, the set condition may be satisfied.

Based on the idle state of the electronic device being maintained for the set time and there being no history of application optimization being performed for all applications of the electronic device, the set condition may be satisfied.

Based on the instructions being executed by the processor, the processor may be further configured to: dynamically adjust processor affinity of the electronic device based on the electronic device leaving the idle state while the generating of the optimized application is being performed.

Based on the instructions being executed by the processor, the processor may be further configured to: predict the duration of the idle state based on the usage record of the electronic device, and estimate a time required to generate the optimized application, wherein the generating of the optimized application may be performed based on the predicted time being longer than the estimated time.