[PATCH] D21103: optimized xsgetn for better performance
Laxman Sole via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 9 12:13:28 PDT 2016
laxmansole updated this revision to Diff 60222.
http://reviews.llvm.org/D21103
Files:
libcxx/include/streambuf
Index: libcxx/include/streambuf
===================================================================
--- libcxx/include/streambuf
+++ libcxx/include/streambuf
@@ -495,12 +495,22 @@
const int_type __eof = traits_type::eof();
int_type __c;
streamsize __i = 0;
- for (;__i < __n; ++__i, ++__s)
+ while(__i < __n)
{
if (__ninp_ < __einp_)
- *__s = *__ninp_++;
+ {
+ const streamsize __len = _VSTD::min(__einp_ - __ninp_, __n - __i);
+ traits_type::copy(__s, __ninp_, __len);
+ __s += __len;
+ __i += __len;
+ this->gbump(__len);
+ }
else if ((__c = uflow()) != __eof)
+ {
*__s = traits_type::to_char_type(__c);
+ ++__s;
+ ++__i;
+ }
else
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21103.60222.patch
Type: text/x-patch
Size: 844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160609/8ad040bd/attachment.bin>
More information about the llvm-commits
mailing list