Skip to content

Commit 7507408

Browse files
committed
optimize the performance of the function appendFormatRFC3339
1 parent 9b2f747 commit 7507408

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/time/format.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,10 @@ func appendInt(b []byte, x int, width int) []byte {
464464
return b
465465
}
466466

467-
const unitsDigit = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
468-
const tensDigit = "0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999"
467+
const unitsDigit = "01234567890123456789012345678901234567890123456789" +
468+
"01234567890123456789012345678901234567890123456789"
469+
const tensDigit = "00000000001111111111222222222233333333334444444444" +
470+
"55555555556666666666777777777788888888889999999999"
469471

470472
// appendIntWidth2 special scenario for appendInt, with parameter width=2
471473
func appendIntWidth2(b []byte, x int) []byte {

0 commit comments

Comments
 (0)