[libcxx-commits] [libcxx] c3478ef - [libc++] reduce <complex> parsing time
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 19 13:31:32 PST 2020
> On Feb 19, 2020, at 16:25, Shoaib Meenai <smeenai at fb.com> wrote:
>
> We try to handle attribution of changes by just setting the author field in the git commit now. See https://llvm.org/docs/DeveloperPolicy.html#commit-messages <https://llvm.org/docs/DeveloperPolicy.html#commit-messages> (the part about `git commit --amend -author=foo`).
Did that change recently? Actually, I commit so many patches from contributors that I was thinking we should move libc++ contributions to GitHub PRs. That would handle attribution automatically and it would be a huge time saver for me.
Louis
>
> On 2/19/20, 1:11 PM, "libcxx-commits on behalf of Louis Dionne via libcxx-commits" <libcxx-commits-bounces at lists.llvm.org <mailto:libcxx-commits-bounces at lists.llvm.org> on behalf of libcxx-commits at lists.llvm.org <mailto:libcxx-commits at lists.llvm.org>> wrote:
>
>
> Author: Louis Dionne
> Date: 2020-02-19T16:09:41-05:00
> New Revision: c3478eff7a65d6a77b34e756eabc7176a2b422e8
>
> URL: https://github.com/llvm/llvm-project/commit/c3478eff7a65d6a77b34e756eabc7176a2b422e8
> DIFF: https://github.com/llvm/llvm-project/commit/c3478eff7a65d6a77b34e756eabc7176a2b422e8.diff
>
> LOG: [libc++] reduce <complex> parsing time
>
> 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%)
>
> Thanks to Nikita Kniazev for the patch!
>
> Differential Revision: https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D71214&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=XuTdLMSODcBurUaZJqLFRiaiyfpAa42AzWBOtuIiGIo&s=3_bf2u3BzVaTij2ojvXF2pRN5HaZoTadNpfdnHKropw&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D71214&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=XuTdLMSODcBurUaZJqLFRiaiyfpAa42AzWBOtuIiGIo&s=3_bf2u3BzVaTij2ojvXF2pRN5HaZoTadNpfdnHKropw&e=>
>
> Added:
>
>
> Modified:
> libcxx/include/complex
>
> Removed:
>
>
>
> ################################################################################
> diff --git a/libcxx/include/complex b/libcxx/include/complex
> index c168406befbd..92295be976cc 100644
> --- a/libcxx/include/complex
> +++ b/libcxx/include/complex
> @@ -243,7 +243,7 @@ template<class T, class charT, class traits>
> #include <type_traits>
> #include <stdexcept>
> #include <cmath>
> -#include <sstream>
> +#include <iosfwd>
> #include <version>
>
> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
> @@ -1406,10 +1406,10 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
> __x = complex<_Tp>(__r, __i);
> }
> else
> - __is.setstate(ios_base::failbit);
> + __is.setstate(__is.failbit);
> }
> else
> - __is.setstate(ios_base::failbit);
> + __is.setstate(__is.failbit);
> }
> else if (__c == _CharT(')'))
> {
> @@ -1417,10 +1417,10 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
> __x = complex<_Tp>(__r, _Tp(0));
> }
> else
> - __is.setstate(ios_base::failbit);
> + __is.setstate(__is.failbit);
> }
> else
> - __is.setstate(ios_base::failbit);
> + __is.setstate(__is.failbit);
> }
> else
> {
> @@ -1429,11 +1429,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
> if (!__is.fail())
> __x = complex<_Tp>(__r, _Tp(0));
> else
> - __is.setstate(ios_base::failbit);
> + __is.setstate(__is.failbit);
> }
> }
> else
> - __is.setstate(ios_base::failbit);
> + __is.setstate(__is.failbit);
> return __is;
> }
>
> @@ -1441,12 +1441,7 @@ template<class _Tp, class _CharT, class _Traits>
> basic_ostream<_CharT, _Traits>&
> operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
> {
> - basic_ostringstream<_CharT, _Traits> __s;
> - __s.flags(__os.flags());
> - __s.imbue(__os.getloc());
> - __s.precision(__os.precision());
> - __s << '(' << __x.real() << ',' << __x.imag() << ')';
> - return __os << __s.str();
> + return __os << '(' << __x.real() << ',' << __x.imag() << ')';
> }
>
> #if _LIBCPP_STD_VER > 11
>
>
>
> _______________________________________________
> libcxx-commits mailing list
> libcxx-commits at lists.llvm.org <mailto:libcxx-commits at lists.llvm.org>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=XuTdLMSODcBurUaZJqLFRiaiyfpAa42AzWBOtuIiGIo&s=TK2KMcCqvhVplbQrWBvFZeh08C5F0zsMjwyRxF2Rqfo&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=XuTdLMSODcBurUaZJqLFRiaiyfpAa42AzWBOtuIiGIo&s=TK2KMcCqvhVplbQrWBvFZeh08C5F0zsMjwyRxF2Rqfo&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200219/fd14b887/attachment-0001.html>
More information about the libcxx-commits
mailing list