Number and Date Format in 68 is slower than 67

Description

This is a upstream bug of https://bugs.chromium.org/p/chromium/issues/detail?id=1145897

the JS test in chrome show a 12-18% performance regression on some machines

In the JS test, we found (mostly) regression on date format, the performance is based on the following function
https://source.chromium.org/chromium/chromium/src/+/master:v8/test/js-perf-test/Dates/toLocaleString.js
function DateToLocaleDateString() {
let d = new Date();
d.toLocaleDateString()
}
createSuite('toLocaleDateString', 100000, DateToLocaleDateString, ()=>{});

function DateToLocaleString() {
let d = new Date();
d.toLocaleString()
}
createSuite('toLocaleString', 100000, DateToLocaleString, ()=>{});

function DateToLocaleTimeString() {
let d = new Date();
d.toLocaleTimeString()
}
createSuite('toLocaleTimeString', 100000, DateToLocaleTimeString, ()=>{});

I have hard time to see the diff between pre 68 and 68 in my local machine, But while I try to run ICU's Date Format benchmark, I can see the differencs

Here is what I try (in icu4c/source dir)
git checkout maint/maint-68
cd ../../..
mkdir perf68
cd perf68
../icu/icu4c/source/runConfigureICU Linux/gcc -disable-layoutex
make clean
make -j 120 tests
cd test/perf/DateFmtPerf/
make clean
make -j 120
LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:../../../lib:../../../stubdata:../../../tools/ctestfw:$LD_LIBRARY_PATH ./DateFmtPerf -i 10 -p 10 DateFmt10000

= DateFmt10000 begin
= DateFmt10000 end 0.869541 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.837583 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.838710 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.838474 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.834801 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.825372 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.832576 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.824278 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.817539 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.831612 10 10000
done!

cd ../../../../icu/icu4c/source
git checkout maint/maint-67
cd ../../..
mkdir perf67
cd perf67

../icu/icu4c/source/runConfigureICU Linux/gcc -disable-layoutex
make clean
make -j 120 tests
cd test/perf/DateFmtPerf/
make clean
make -j 120
LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:../../../lib:../../../stubdata:../../../tools/ctestfw:$LD_LIBRARY_PATH ./DateFmtPerf -i 10 -p 10 DateFmt10000

= DateFmt10000 begin
= DateFmt10000 end 0.839755 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.794858 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.796001 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.800345 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.804655 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.801828 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.799331 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.803702 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.801910 10 10000
= DateFmt10000 begin
= DateFmt10000 end 0.804057 10 10000
done!

the 68 number looks spend 3.78% more time than the 67
see
https://docs.google.com/spreadsheets/d/1QR7syUkvrrLG1EbzXzbUJEyzRCQ4fiSJw5Aec_YEZ7k/edit?usp=sharing

Activity

Show:
Frank Yung-Fong Tang
December 16, 2020, 6:50 PM

the remaining work go to for changes after 68.2

Shane Carr
December 9, 2020, 7:45 PM

Is this issue fixed, or is there still more work to do for 68.2?

Hugo van der Merwe
November 18, 2020, 11:08 PM

This patch is currently the only commit in this draft PR:

Frank Yung-Fong Tang
November 17, 2020, 5:47 PM

The following patch help a little bit.

Frank Yung-Fong Tang
November 12, 2020, 7:19 PM

To see the profile , do this (following http://site.icu-project.org/setup/callgrind )

(notice I remove gcc after Linux/)

git checkout maint/maint-68
cd ../../..
mkdir perf68
cd perf68
../icu/icu4c/source/runConfigureICU Linux -disable-layoutex
make clean
make -j 120 tests
cd test/perf/DateFmtPerf/
make clean
make -j 120

LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:../../../lib:../../../stubdata:../../../tools/ctestfw:$LD_LIBRARY_PATH LD_BIND_NOW=y valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./DateFmtPerf -i 1 -p 10 DateFmt10000

kcachegrind callgrind.out

Fixed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Hugo van der Merwe

Reporter

Frank Yung-Fong Tang

Components

Labels

Priority

medium

Fix versions