Page MenuHomePhabricator

[libc++] reduce <complex> parsing time
ClosedPublic

Authored by nick on Dec 9 2019, 9:53 AM.

Details

Reviewers
ldionne
mclow.lists
EricWF
Group Reviewers
Restricted Project
Commits
rGc3478eff7a65: [libc++] reduce <complex> parsing time
Summary

Instead of including <ios> for ios_base::failbit simply get failbit member of the template argument.
Print directly to a stream instead of using intermediate ostringstream.

Parsing time: 874ms -> 164ms (-81%)

Diff Detail

Event Timeline

nick created this revision.Dec 9 2019, 9:53 AM
ldionne accepted this revision.Jan 29 2020, 5:06 PM

Do you have commit access?

libcxx/include/complex
1444

I'm thinking there must be a reason why it was written that way, but I can't think of any and your version indeed seems more straightforward.

This revision is now accepted and ready to land.Jan 29 2020, 5:06 PM
nick marked an inline comment as done.Jan 29 2020, 5:15 PM

No, I do not have commit rights.

libcxx/include/complex
1444

I tried to dig into history and the code is from initial commit, so I hoped I will get insights during the review.

Thanks for the patch!

This revision was automatically updated to reflect the committed changes.
cantonios added inline comments.
libcxx/include/complex
1444

It was written this way to respect properties like field width. This now breaks fixed-width printing of complex numbers.

See https://reviews.llvm.org/D78816

Herald added a reviewer: Restricted Project. · View Herald TranscriptApr 24 2020, 9:45 AM
nick marked an inline comment as done.Apr 24 2020, 10:53 AM
nick added inline comments.
libcxx/include/complex
1444

Right, @ldionne could you please revert the commit as I do not have a fix for that