Minor performance improvement on page load
authorAlexander Ebert <ebert@woltlab.com>
Thu, 19 Oct 2017 18:47:57 +0000 (20:47 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 19 Oct 2017 18:47:57 +0000 (20:47 +0200)
Relative timestamps are pre-computed on the server-side as of WSC 3.1,
making it unnecessary to refresh them on load. Instead we can get away
by performing it on the first significant DOM change or using the
once-per-minute refresh.

On averge this saves around 5-10ms on init

wcfsetup/install/files/js/WoltLabSuite/Core/Date/Time/Relative.js

index 7d1cc8bfaa67e28a39c5faf81f8f24b304c729e3..dbf62895897e73472fead509b990263c932b79b0 100644 (file)
@@ -22,8 +22,6 @@ define(['Dom/ChangeListener', 'Language', 'WoltLabSuite/Core/Date/Util', 'WoltLa
                 * Transforms <time> elements on init and binds event listeners.
                 */
                setup: function() {
-                       this._refresh();
-                       
                        new Repeating(this._refresh.bind(this), 60000);
                        
                        DomChangeListener.add('WoltLabSuite/Core/Date/Time/Relative', this._refresh.bind(this));