[Interest] QStringLiteral and Visual Studio 2017 15.3 :(

Philippe philwave at gmail.com
Wed Oct 18 16:58:42 CEST 2017


FYI, I just discovered that QStringLiteral has become pretty expensive under Visual Studio 2017 15.3, compared to the past (Visual Studio 2015).

Much more assembly code generated for the associated lambda, and _Init_thread_header / _Init_thread_footer is called at the first call of each instance of QStringLiteral .
(which actually seems right, because of C++11's thread safe initialisations of static variables).
Not sure to see any longer some interest in QStringLiteral...

release-mode code generated for the related lambda: for VS 2017.3 / Qt 5.9.1

s = QStringLiteral("hello");
00000001400B0E50 48 89 54 24 10       mov         qword ptr [rsp+10h],rdx  
00000001400B0E55 53                   push        rbx  
00000001400B0E56 48 83 EC 30          sub         rsp,30h  
00000001400B0E5A 48 C7 44 24 28 FE FF FF FF mov         qword ptr [rsp+28h],0FFFFFFFFFFFFFFFEh  
00000001400B0E63 48 8B DA             mov         rbx,rdx  
00000001400B0E66 C7 44 24 20 00 00 00 00 mov         dword ptr [rsp+20h],0  
00000001400B0E6E BA 04 00 00 00       mov         edx,4  
00000001400B0E73 65 48 8B 04 25 58 00 00 00 mov         rax,qword ptr gs:[58h]  
00000001400B0E7C 48 8B 08             mov         rcx,qword ptr [rax]  
00000001400B0E7F 8B 04 0A             mov         eax,dword ptr [rdx+rcx]  
00000001400B0E82 39 05 AC A1 14 00    cmp         dword ptr [TSS0<`template-parameter-2',ambda_3fac06832ce696139eca9cbb96d71ab3>,QString,void,int, ?? &> (01401FB034h)],eax  
00000001400B0E88 7E 5F                jle         <lambda_3fac06832ce696139eca9cbb96d71ab3>::operator()+99h (01400B0EE9h)  
00000001400B0E8A 48 8D 0D A3 A1 14 00 lea         rcx,[TSS0<`template-parameter-2',ambda_3fac06832ce696139eca9cbb96d71ab3>,QString,void,int, ?? &> (01401FB034h)]  
00000001400B0E91 E8 B6 14 03 00       call        _Init_thread_header (01400E234Ch)  
00000001400B0E96 90                   nop  
00000001400B0E97 83 3D 96 A1 14 00 FF cmp         dword ptr [TSS0<`template-parameter-2',ambda_3fac06832ce696139eca9cbb96d71ab3>,QString,void,int, ?? &> (01401FB034h)],0FFFFFFFFh  
00000001400B0E9E 75 49                jne         <lambda_3fac06832ce696139eca9cbb96d71ab3>::operator()+99h (01400B0EE9h)  
00000001400B0EA0 C7 05 36 9C 14 00 FF FF FF FF mov         dword ptr [qstring_literal (01401FAAE0h)],0FFFFFFFFh  
00000001400B0EAA 48 C7 05 2F 9C 14 00 05 00 00 00 mov         qword ptr [qstring_literal+4h (01401FAAE4h)],5  
00000001400B0EB5 48 C7 05 30 9C 14 00 18 00 00 00 mov         qword ptr [qstring_literal+10h (01401FAAF0h)],18h  
00000001400B0EC0 F2 0F 10 05 30 9C 10 00 movsd       xmm0,mmword ptr [string "h\0e\0l\0l\0o\0\0" (01401BAAF8h)]  
00000001400B0EC8 F2 0F 11 05 28 9C 14 00 movsd       mmword ptr [qstring_literal+18h (01401FAAF8h)],xmm0  
00000001400B0ED0 8B 05 2A 9C 10 00    mov         eax,dword ptr [string "h\0e\0l\0l\0o\0\0"+8h (01401BAB00h)]  
00000001400B0ED6 89 05 24 9C 14 00    mov         dword ptr [qstring_literal+20h (01401FAB00h)],eax  
00000001400B0EDC 48 8D 0D 51 A1 14 00 lea         rcx,[TSS0<`template-parameter-2',ambda_3fac06832ce696139eca9cbb96d71ab3>,QString,void,int, ?? &> (01401FB034h)]  
00000001400B0EE3 E8 04 14 03 00       call        _Init_thread_footer (01400E22ECh)  
00000001400B0EE8 90                   nop  
00000001400B0EE9 48 8D 05 F0 9B 14 00 lea         rax,[qstring_literal (01401FAAE0h)]  
00000001400B0EF0 48 89 03             mov         qword ptr [rbx],rax  
00000001400B0EF3 C7 44 24 20 01 00 00 00 mov         dword ptr [rsp+20h],1  
00000001400B0EFB 48 8B C3             mov         rax,rbx  
00000001400B0EFE 48 83 C4 30          add         rsp,30h  
00000001400B0F02 5B                   pop         rbx  
00000001400B0F03 C3                   ret  
00000001400B0F04 CC                   int         3  



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171018/af6100b7/attachment.html>


More information about the Interest mailing list