Bug 64998

Summary: emf convert png too slow
Product: POI Reporter: liming-coder <652611857>
Component: XSLFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 4.1.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   
Attachments: image1.emf

Description liming-coder 2020-12-17 08:16:17 UTC
Created attachment 37622 [details]
image1.emf

convert the attached emf to png is too slow(~20s). 
on my machine, other wmf/emf conversion is quite fast(normally <1s).
Comment 1 liming-coder 2020-12-17 08:22:35 UTC
also i feel the lastest version is a bit slowdown regarding emf/wmf conversion, though there is no acutual benchmark test.
Comment 2 liming-coder 2020-12-17 08:33:06 UTC
i tried https://www.photopea.com/ by dragging the image1.emf into it. it display lines and shapes quite fast, and then it start loading some fonts,which is a bit slow(maybe it need to load font from server).
with poi,maybe it's also related to font loading?
Comment 3 liming-coder 2020-12-17 08:33:36 UTC
i tried https://www.photopea.com/ by dragging the image1.emf into it. it display lines and shapes quite fast, and then it start loading some fonts,which is a bit slow(maybe it need to load font from server).
with poi,maybe it's also related to font loading?
Comment 4 liming-coder 2020-12-17 08:36:47 UTC
i also tried https://www.photopea.com/ by dragging image1.emf into it. it displays lines and shapes quite fast, then it start loading somes fallback fonts, which is a bit slow(i guess these fonts need to load from server).

with poi, maybe it's the same font loading problem??
Comment 5 liming-coder 2020-12-17 08:38:37 UTC
shit, i posted it three times. sorry. maybe slow network...
Comment 6 Andreas Beeker 2020-12-18 21:42:24 UTC
Sometimes adding -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine to the JVM args helps - see the render page for more details.

In this case it didn't make any difference.
I've tested it with Java 14 (2.5sec) and Java 8 (9.2sec) on my machine.

I'll try a bit of profiling now.
Comment 7 liming-coder 2020-12-23 08:10:16 UTC
can you post the render page link please.

thanks.
Comment 9 Andreas Beeker 2020-12-23 18:36:21 UTC
I forgot to mentioned, that I've profiled the slideshow and most of the time is spent in Graphics2D.draw(), but doesn't mean POI isn't to be blamed of the bad performance.

My guess is, the culprit are the dotted lines - those can be really time-consuming when the wrong scaling and other parameters are given. Parts of the image are anyway distorted, but I haven't found out why yet ...