Browse Source

REPORT-80511 启始页启动速度优化

1-记录时间不准,要从头开始记录
2-去掉预热的影响,对直接启动的客户不友好
3-不去每次都读图片,在等待时候,IO 频率极高。
newui
Harrison 2 years ago
parent
commit
042b9e659f
  1. 5
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  2. 5
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  3. 16
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

5
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -74,6 +74,8 @@ public class StartupPageWindow extends JFrame {
private static final Dimension SCREEN_SIZE = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
private static final BufferedImage BACKGROUND_IMAGE = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg");
private StartupPageWorkspacePanel workspacePanel;
private JPanel recentOpenPanel;
@ -136,8 +138,7 @@ public class StartupPageWindow extends JFrame {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
BufferedImage image = IOUtils.readImage("com/fr/design/startup/startup_page_background.jpg");
g.drawImage(image, 0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height, this);
g.drawImage(BACKGROUND_IMAGE, 0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height, this);
}
};
this.contentPane.setLayout(getCenterLayout(body));

5
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -119,12 +119,13 @@ public class MainDesigner extends BaseDesigner {
* @param args 参数
*/
public static void main(String[] args) {
StopWatch watch = new StopWatch();
watch.start();
DesignerStartupContext.getRecorder().start();
showSplash();
startPreload0();
StopWatch watch = new StopWatch();
watch.start();
DesignerLifecycleMonitorContext.getMonitor().beforeStart();
//启动运行时
FineRuntime.start();

16
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

@ -9,7 +9,6 @@ import com.fr.start.SplashContext;
import com.fr.start.common.DesignerStartupContext;
import com.fr.start.module.StartupArgs;
import com.fr.start.util.DesignerStartupPageUtil;
import com.fr.start.warmup.DesignerPreWarmTask;
import com.fr.startup.metric.DesignerMetrics;
import com.fr.startup.metric.DesignerStartupModel;
import com.fr.startup.ui.StartupPageModel;
@ -63,10 +62,6 @@ public class DesignerStartupPageActivator extends Activator {
// 启动页关闭
SplashContext.getInstance().hide();
// 预热任务启动
DesignerPreWarmTask warmTask = new DesignerPreWarmTask();
warmTask.start();
// 即时暂停
suspendRecorder(context);
@ -79,21 +74,21 @@ public class DesignerStartupPageActivator extends Activator {
model.setOpenLastTemplateRunnable(() -> {
context.setOpenLastFile(true);
handleModel(model);
launchAfterWarmup(warmTask);
launchAfterWarmup();
});
// selectAndOpenEmpty
model.setOpenEmptyTemplateRunnable(() -> {
context.setOpenEmpty(true);
handleModel(model);
launchAfterWarmup(warmTask);
launchAfterWarmup();
});
// selectAndCreateNew
model.setCreateNewTemplateRunnable(() -> {
context.setCreateNew(true);
handleModel(model);
launchAfterWarmup(warmTask);
launchAfterWarmup();
});
StartupPageWindow window = new StartupPageWindow(model);
@ -123,7 +118,7 @@ public class DesignerStartupPageActivator extends Activator {
});
}
private void launchAfterWarmup(DesignerPreWarmTask warmTask) {
private void launchAfterWarmup() {
StopWatch stopWatch = StopWatch.createStarted();
@ -133,9 +128,6 @@ public class DesignerStartupPageActivator extends Activator {
// 等待中切换
DesignerStartupContext.getInstance().setOnWaiting(false);
warmTask.join();
FineLoggerFactory.getLogger().debug("designer-startup-page warm up cost {} ms", stopWatch.getTime(TimeUnit.MILLISECONDS));
DesignerStartupContext.getInstance().setOnStartup(true);
DesignerStartupPageUtil.enterWorkspace();
} finally {

Loading…
Cancel
Save