You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use musl implementation of strftime rather than custom JS code. NFC (#21379)
This leads to some code size savings in several tests, reduces the
differences between standalone mode and non-standalone mode and reduces
the amount of custom JS code we need to maitain.
In simple microbenchmark that does nothing but export `strftime` we do
code size win at `-O0` but a regression in codesize at `-O2`:
```
$ wc -c old_O0.*
74026 old.js
12124 old.wasm
86150 total
$ wc -c new_O0.*
62120 new.js
22852 new.wasm
84972 total
```
```
$ wc -c old_O2.*
8492 old.js
194 old.wasm
8686 total
$ wc -c new_O2.*
5040 new.js
14291 new.wasm
19331 total
```
This regression comes from the fact that `snprintf` is used in the
implementation of `strftime` and its hard to optimize away the cost of
that function.
In practice I suspect that any application large enough to call
`strftime` is likely already directly or indirectly pulling in
`snprintf` so I would hope that this will be codesize win in practice
since it removes about 3k of JS.
'%r': '%I:%M:%S%p', // Replaced by the time in a.m. and p.m. notation
765
-
'%R': '%H:%M', // Replaced by the time in 24-hour notation
766
-
'%T': '%H:%M:%S', // Replaced by the time
767
-
'%x': '%m/%d/%y', // Replaced by the locale'sappropriatedaterepresentation
768
-
'%X': '%H:%M:%S', // Replaced by the locale'sappropriatetimerepresentation
769
-
// Modified Conversion Specifiers
770
-
'%Ec': '%c', // Replaced by the locale'salternativeappropriatedateandtimerepresentation.
771
-
'%EC': '%C', // Replaced by the name of the base year (period) in the locale'salternativerepresentation.
772
-
'%Ex': '%m/%d/%y', // Replaced by the locale'salternativedaterepresentation.
773
-
'%EX': '%H:%M:%S', // Replaced by the locale'salternativetimerepresentation.
774
-
'%Ey': '%y', // Replaced by the offset from %EC (year only) in the locale'salternativerepresentation.
775
-
'%EY': '%Y', // Replaced by the full alternative year representation.
776
-
'%Od': '%d', // Replaced by the day of the month, using the locale'salternativenumericsymbols,filledasneededwithleadingzerosifthereisanyalternativesymbolforzero;otherwise,withleading<space>characters.
777
-
'%Oe': '%e', // Replaced by the day of the month, using the locale'salternativenumericsymbols,filledasneededwithleading<space>characters.
778
-
'%OH': '%H', // Replaced by the hour (24-hour clock) using the locale'salternativenumericsymbols.
779
-
'%OI': '%I', // Replaced by the hour (12-hour clock) using the locale'salternativenumericsymbols.
780
-
'%Om': '%m', // Replaced by the month using the locale'salternativenumericsymbols.
781
-
'%OM': '%M', // Replaced by the minutes using the locale'salternativenumericsymbols.
782
-
'%OS': '%S', // Replaced by the seconds using the locale'salternativenumericsymbols.
783
-
'%Ou': '%u', // Replaced by the weekday as a number in the locale'salternativerepresentation(Monday=1).
784
-
'%OU': '%U', // Replaced by the week number of the year (Sunday as the first day of the week, rules corresponding to %U ) using the locale'salternativenumericsymbols.
785
-
'%OV': '%V', // Replaced by the week number of the year (Monday as the first day of the week, rules corresponding to %V ) using the locale'salternativenumericsymbols.
786
-
'%Ow': '%w', // Replaced by the number of the weekday (Sunday=0) using the locale'salternativenumericsymbols.
787
-
'%OW': '%W', // Replaced by the week number of the year (Monday as the first day of the week) using the locale'salternativenumericsymbols.
788
-
'%Oy': '%y', // Replaced by the year (offset from %C ) using the locale'salternativenumericsymbols.
789
-
'%c': '%a %b %d %H:%M:%S %Y',// Replaced by the locale's appropriate date and time representation - e.g., Mon Aug 3 14:02:01 2013
0 commit comments