Bug 107561 - The while loop for Javascript presentation engine
Summary: The while loop for Javascript presentation engine
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
5.3.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-02 10:56 UTC by fxwan
Modified: 2018-09-03 14:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fxwan 2017-05-02 10:56:43 UTC
Description:
Seems like exported JS presentation engine is directly generated from cpp version, here: https://github.com/LibreOffice/core/blob/2eae33e82e5f91d6dbaf7e8e848f53644596059d/slideshow/source/engine/slideshowimpl.cxx#L2370

The generated JS looks like this:
FrameSynchronization.prototype.synchronize = function()
{
if( this.bIsActive )
{
while( this.aTimer.getElapsedTime() < this.nNextFrameTargetTime )
;
} 
this.markCurrentFrame();
}

The while loop will be CPU hogging and make the UI no response, so I think this kind of code should be optimized to schedule in a Timer/requestAnimationFrame.

FrameSynchronization.prototype.synchronize = function()
{
if ( this.bIsActive && ( this.aTimer.getElapsedTime() < this.nNextFrameTargetTime )) {
   setTimeout(this.synchronize.bind(this), 16);
}
else {
   this.markCurrentFrame();
}
}
  


Steps to Reproduce:
1. Open a slide with long time animations
2.
3.

Actual Results:  
CPU hogging and janky animation

Expected Results:
Smooth animation and use much lesser CPU cycles.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36
Comment 1 fxwan 2017-05-02 11:01:10 UTC
I can't find the source code of presentation engine in Javascript, so I think the code is auto-generated. Do you have any plan to implement a more 'Web' native presentation engine that utilize CSS animation,CSS transitions,Web Animation, SVG <animate> tag, requestAnimationFrame?
Comment 2 Julien Nabet 2017-05-02 19:23:23 UTC
Code pointer:
http://opengrok.libreoffice.org/xref/core/slideshow/source/engine/slideshowimpl.cxx#2370

Thank you for this analysis and suggestion!
I'm not an expert, just a simple contributor, but if interested and have some time, you may contribute by following this link:
https://wiki.documentfoundation.org/Development/GetInvolved
Comment 3 fxwan 2017-05-03 03:17:19 UTC
(In reply to Julien Nabet from comment #2)
> Code pointer:
> http://opengrok.libreoffice.org/xref/core/slideshow/source/engine/
> slideshowimpl.cxx#2370
> 
> Thank you for this analysis and suggestion!
> I'm not an expert, just a simple contributor, but if interested and have
> some time, you may contribute by following this link:
> https://wiki.documentfoundation.org/Development/GetInvolved

Hello, Julien.

I can't find the source of Javascript code, so I guess the code is auto-generated from cpp code via scripts. Thanks for the link, I will try to find an angle to attack.
Comment 4 Buovjaga 2017-05-06 13:55:39 UTC
You can contact the developers on IRC #libreoffice-dev (most are active during weekdays): https://wiki.documentfoundation.org/Website/IRC
Or mailing list: https://wiki.documentfoundation.org/Development/Mailing_List
Comment 5 Xisco Faulí 2017-11-04 18:05:55 UTC
Dear fxwan,
Could you please submit a patch to gerrit as described here:
https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch?
Comment 6 Xisco Faulí 2018-01-09 11:21:56 UTC
(In reply to Xisco Faulí from comment #5)
> Dear fxwan,
> Could you please submit a patch to gerrit as described here:
> https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch?

Setting to NEEDINFO until the reporter gives some signs of life...
Comment 7 QA Administrators 2018-07-31 09:38:11 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2018-09-03 14:57:23 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20180903