Java -ea option causes rendering to be much slower in some cases

0 votes
asked Jan 11, 2017 in Bug by krasa (820 points)
java -jar plantuml.8053.jar hello.puml -duration
Duration = 0.548 seconds
                   
java -ea -jar plantuml.8053.jar hello.puml -duration
Duration = 0.543 seconds
 
 
java -jar plantuml.8053.jar slow.puml -duration
Duration = 0.944 seconds
 
java -ea -jar plantuml.8053.jar slow.puml -duration
Duration = 6.807 seconds
 
 
 
I found an ugly performance problem for one of my diagrams, while using IntelliJ, which has -ea by default.
I Could make a fix for the IntelliJ plugin - make a new ClassLoader for the plantuml jar which would have asserts disabled, but perhaps it would be better to fix this performance problem in plantuml itself...
 
 
 
@startuml
 
title 09-foo
 
skinparam sequence { 
   ArrowColor #000000
  
   BoxBorderColor transparent
  
   LifeLineBorderColor #A0A0A0
   LifeLineBackgroundColor #FFFFF5
  
   ParticipantBorderColor #000000
   ActorBorderColor #000000
  
   ArrowFontColor #000000
   ArrowFontSize 11
  
   MessageAlign center
}
 
skinparam note {
   BackgroundColor #F0F0F0
   BorderColor #A0A0A0
}
 
'skinparam monochrome true
 
autonumber  "<b>00"
 
box "DT" #FFF5FA
    participant "YYY" as TRI
    participant "XDR" as XDR
   participant "QQQ" as AAA
end box
 
box "Partner" #E5F0FF
   participant "QQQ" as NNN
end box
 
loop read qqq events
 
activate AAA
activate NNN
 
AAA -> NNN : read one foo event
NNN -->> AAA : foo event
 
 
alt UUU is not active
AAA -> NNN: decline foo 
NNN -->> AAA
 
 
else UUU is active
 
alt qqq event is duplicate
 
AAA -> NNN: approve foo again
NNN -->> AAA:
 
 
 
else no duplicate 
 
AAA -> XDR : qqq
    activate XDR
 
XDR -> TRI: qqq
    activate TRI
TRI -->> XDR: www foo
    deactivate TRI
 
XDR -->> AAA: www foo
    deactivate XDR
 
alt foo was successfull
 
AAA -> AAA : store 
AAA -> AAA :  event
 
 
alt is first foo event with eee flag
 
AAA -> AAA : store eee date
AAA -> AAA : event
end
 
AAA -> NNN : approve foo
NNN -->> AAA: www qqq result
 
alt approve foo rejected by QQQ
 
AAA -> XDR: zzz foo
    activate XDR
XDR -> TRI: zzz bar
    activate TRI
TRI -->> XDR:
    deactivate TRI
XDR -->> AAA:
    deactivate XDR
end
 
 
else foo failed
 
AAA -> NNN: decline foo 
NNN -->> AAA : www qqq result
end
 
 
end
end
end
 
deactivate AAA
deactivate NNN
@enduml
 

1 Answer

0 votes
answered Jan 11, 2017 by plantuml (295,000 points)
selected Oct 10, 2018 by krasa
 
Best answer
Yes we use assertions because it's very useful to do controls (invariant, postconditions, preconditions...).

It's really a pity that IntelliJ runs by default with -ea option because by default assertions are disabled.

So running slowly with assertion enabled is not really a bug and we really prefer to keep our assertions.

Is this a big task for you to fix the plugin by using a new Class Loader ?
commented Jan 11, 2017 by krasa (820 points)
No problem, I have already done that for another thing (Eclipse Formatter)...

I thought it was a bug, since other similar diagrams had not this kind of slow down.
commented Jan 11, 2017 by krasa (820 points)
So I disabled them with one line of code, and it works ~25x faster now... Awesome! Turned out, calling getClassLoader().setDefaultAssertionStatus(false); in the plugin was enough.
...