[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanbat and ayman shoukly)
1. Ayman Shoukry – Principal Group Program Manager – Visual C++, Microsoft
Ulzii Luvsanbat – Principal Software Engineering Manager – Visual C++, Microsoft
What’s New in Visual Studio 2015 and
Future Directions
2. A note on our mission
• Visual Studio will be the best IDE out there for EVERY C++ de
veloper.
• Not just Windows developers
• Especially for Open Source developers
• C++ is *the* language for cross platform development
• Which is why C++ development is actually growing share amongst p
ro devs
• We can make C++ development more productive
• Finish catching up on conformance, participate in standards b
odies to help make the language better. Stay caught up.
3. Saving the best for first
• Before (VS2013):
• After (VS2015):
5. Not new: Common Misconceptions
•You can still target XP in VS2015
•You can still do app-local deployme
nt
6. Demo: Language Agnostic IDE
Goodness
• Custom Window Layouts
• Touch screen enhancements
• Send-a-smile (or frown if you must)
• Find in file append
• Git and Github integration
7. Demo: C++ IDE Productivity
• Refactors (precision and accuracy)
• Create Definition <-> Declaration (multiple)
• Move function definition
• Implement Pure Virtual
• Rename
• Extract Method
• Convert to Raw String Literal
• Single File Intellisense
• Quick editing of a makefile project or file->new file and int main, etc
8. Refactoring for C++
• Extract Method (VS Extension)
Refactoring for C++
• Rename
Productivity (IDE)
9. Refactoring for C++
• Implement Pure Virtuals
Quickly implement pure virtual functions in inherited constructs
• Create Declaration/Definition
Quickly create a function’s declaration from its definition (and vice-versa)
• Move Definition Location
Move a function’s declaration inline and out-of-line
• Convert to Raw-String Literal
Convert strings littered with escape sequences into a much more easily readable form
Productivity (IDE)
std::string s = "nSome reasons this string is hard
to read:nt1. It would go off the screen in your
editornt2. It has sooooo many escape
sequences.nnThey should make a type for this called
"long" string, har har har.nnHave fun parsing
this! (maybe?)n";
std::string s = R"(
Some reasons this string is hard to read:
1. It would go off the screen in your editor
2. It has sooooo many escape sequences.
They should make a type for this called "long" string, har har har.
Have fun parsing this! (maybe?)
)";
10. Single-File Browsing and IntelliSense support
• Open any source file from disk, and enjoy basic browsing and IntelliSen
se features
(May require setting some defaults)
Productivity (IDE)
11. • Universal App
Easily create projects targeting Store and Phone simultaneously, with a unified IntelliSense exp
erience in the IDE
• Faster, Improved Database Population
Operations like Go To Definition are generally no longer blocked during solution scan, which in
turn completes much faster especially for large solutions
• Simplified QuickInfo for Template Deduction
Elimination of redundant/unhelpful information
• Auto-PCH (VS Extension)
Generate a pre-compiled header based on your project structure for faster compile time
Productivity (IDE)
12. • New and Improved Exceptions “Dialog”
Productivity (IDE)
13. • New and Improved Error List
Productivity (IDE)
14. GPU Usage (available in VS2013 Update 4)
• Launch from the Diagnostics hub
• Create real-time graphs for Frame Time, Frame Rate, and GPU Utilizatio
n
• Analyze detailed GPU usage by inspecting the GPU and CPU execution
time of each individual DirectX event
Productivity (Diagnostics)
15. Visual Studio Graphics Diagnostics
• Visual Studio Graphics Analyzer (VSGA)
A dedicated space for analyzing graphics frames
• Shader Edit & Apply
View impact of shader code changes without re-running the app
• Full support for DirectX12
Productivity (Diagnostics)
16. Native Memory Profiler
• Monitor live memory consumption and take heap snapshots during a d
ebugging session inside Visual Studio.
• View heap contents with C++ types, values, and call stack for each allocation (valu
es are shown only during a break point).
• Diff two snapshots to identify potential leaks.
• Navigate directly to source code from the allocations of interest.
• In-line data tips that show line by line memory performance and link to
source
• See how much memory is being consumed between break points.
• Easily navigate between source code and heap snapshots.
Productivity (Diagnostics)
17. Inspect instance values and their allocation call st
• Memory Performance Data
Tips
Take heap snapshots and view C++ object type
See how much memory is consumed between two breakpoin
Productivity (Diagnostics)
Native Memory Profiler
• Real-time heap analysis
18. IDE
• Refactoring for C++
• Rename
• Extract Method (VS Extension)
• Implement Pure Virtuals
• Create Declaration/Definition
• Move Function Definition
• Convert to Raw-String Literal
• Single-File Browsing and IntelliSense Support
• Universal App
• Faster, Improved Database Buildup
• Simplified QuickInfo for Template Deduction
• Auto-PCH (VS Extension)
Productivity
Build Improvements
• Faster linker when performing full linking
• Improvements in Compiler for template processing
and diagnostics
Diagnostics
• GPU Usage Tool (VS2013 Update 4)
• Visual Studio Graphics Analyzer
• Shader Edit & Apply
• Full support for DirectX12
• Native Memory Profiler
22. // Non-throwing functions may be declared noexcept
void f() noexcept;
void g();
// Can test whether a function is declared noexcept
bool const is_f_noexcept = noexcept(f());
bool const is_g_noexcept = noexcept(g());
//Can conditionally make a function noexcept
void h() noexcept(f);
template <typename F>
void call(F&& lambda) noexcept(lambda());
// If you violate a noexcept specification, std::terminate is called deterministically
noexcept
23. namespace foo
{
inline namespace bar
{
void print() { /* ... */ }
}
}
// Names in foo::bar are used without inline namespace name:
foo::print();
// Name is decorated with inline namespace name:
?print@bar@foo@@YAXXZ (void __cdecl foo::bar::print(void))
Inline Namespaces
24. void f()
{
// Every thread will get its own 'state' variable
thread_local int state = 0;
}
Thread-Local Storage (thread_local)
27. // Literals may now be specified in binary
uint16_t const hex_mask = 0xf0f0;
uint16_t const bin_mask = 0b1111000011110000;
// The ' may now be used as a digit separator
uint32_t const max_value = 4'294'967'295;
uint32_t const max_value = 0xff'ff'ff'ff;
uint16_t const bin_mask = 0b1111'0000'1111'0000;
uint16_t const bin_mask = 0b111'100'001'111'000'0;
uint16_t const bin_mask = 0b1'1'1'1'0'0'0'0'1'1'1'1'0'0'0'0;
Binary Literals and Digit Separators
28. int main()
{
std::cout << __func__ << 'n'; // main
std::cout << __FUNCTION__ << 'n'; // main
}
template <typename T>
void f(T const& s)
{
std::cout << __func__ << 'n'; // f
std::cout << __FUNCTION__ << 'n'; // f
}
__func__
29. // Can inspect alignment of things using alignof
size_t const alignment_of_uint16_t = alignof(uint16_t); // 4
size_t const alignment_of_m256 = alignof(__m256 ); // 32
// Can align objects to a specified alignment
alignas(alignof(32)) unsigned char buffer[32];
Alignment: alignof and alignas
30. char a = 'x';
char b = '☃'; // Wrong
char c = '🍸'; // Wrong
char16_t d = u'x';
char16_t e = u'☃';
char16_t f = u'🍸'; // Wrong
char32_t g = U'x';
char32_t h = U'☃';
char32_t i = U'🍸';
char a = 'u0078';
char b = 'u2603'; // Wrong
char c = 'U0001F378'; // Wrong
char16_t d = u'u0078';
char16_t e = u'u2603';
char16_t f = u'U0001F378'; // Wrong
char32_t g = U'U00000078';
char32_t h = U'U00002603';
char32_t i = U'U0001F378';
Unicode Character Literals
32. std::string a = u8"Hello, u2603!";
std::string b = u8"Hello, ☃!";
std::u16string c = u"Hello, u2603!";
std::u16string d = u"Hello, ☃!";
std::u32string e = U"Hello, u2603!";
std::u32string f = U"Hello, ☃!";
Unicode std::string Specializations
33. // Return types can be automatically deduced:
auto get_value() { return 10; }
// ...This is especially useful for templates:
template <typename T, typename U>
auto multiply(T&& multiplier, U&& multiplicand)
{
return multiplier * multiplicand;
}
Return Type Deduction
34. // Your entire program in C++17:
auto auto(auto) { auto; }
A Brief Interlude: A Preview of C++ 17
41. constexpr size_t fibonacci(size_t const n)
{
return n == 0 ? 0
: n == 1 ? 1
: fibonacci(n - 1) + fibonacci(n - 2);
}
char buffer[fibonacci(10)]; // buffer has 55 elements
constexpr
42. auto multiples_of(unsigned n)
{
unsigned current = n;
for (;;)
{
yield current;
current += n;
}
}
int main()
{
for (unsigned i : multiples_of(3))
{
printf("%d ", i);
if (i > 100) { break; }
}
}
// 3 6 9 12 15 18 21 24 27 30 33 36 39 42 ...
Resumable Functions (await)
43. size_t fibonacci(size_t const n)
{
return n == 0 ? 0
: n == 1 ? 1
: fibonacci(n - 1) + fibonacci(n - 2);
}
char buffer[fibonacci(10)]; // buffer has 55 elements
Expression SFINAE
44. What’s still missing?
• Expression SFINAE to complete C++11
• Major refactor needed -> parse trees
• Significant progress in Update 1 – Partial Support
• Generalized Constexpr (C++14)
• LARGE
• NSDMIs for aggregates (C++14)
• small
• Variable templates (C++14)
• Available under an experimental switch in Update 1
• Two-phase lookup
• C99 Preprocessor
45. STL conformance for VS2015
• Everything but:
Status Std Paper Title
missing C++14 N3462
SFINAE-Friendly result_o
f
missing C++17 N4387
Improving pair And tupl
e
missing C++17 N4508 shared_mutex (Untimed)
46. Library updates
• Universal CRT
• From Windows 10 and up, CRT is an OS component
• Still supported down to XP
• No more breaking changes
• MFC updates:
• Dynamic Layout / Auto-resize for dialogs
• New libraries
• Parallel STL
• New version of Casablanca C++ REST SDK
• OSS and takes contributions
• WebSockets
• oAuth 1.0 and 2.0
• OSX/iOS support, Android, WP8.1, Windows 10 Universal
47. Introducing Clang / C2 Toolset
• Clang / C2 hooks up the Clang front-end to the MSVC backe
nd
• Why?
• use the same frontend to reduce overhead of bring cross-plat librari
es and code to Windows
• no compromises debugging
• link compatible with MSVC code (same libraries)
• Preview coming in Update
• No, we aren't going to stop investing in our existing front-en
d (c1/c1xx)
• we respect your investment in your existing code base
48. A quick note on C99 / C11
• We care about C.
• Our gap isn’t really that large in practice
• Tgmath.h
• Variable length arrays (optional in C11)
• Complex types
• Some other nits
• We’ll get this via Clang / C2
49. New for DirectX Devs
• DirectX12 support
• Shader Edit and
Apply
• Consecutive Capture
• Programmatic
Capture
• Dedicated UI for
Graphics Analysis
50. Productivity pt. 2: Build Throughput
credit: This is my
favorite xkcd.com strip
of all time
51. • Compiler
• Faster template processing
• PDB
• Reduced PDB generation time
• /Debug:fastlink
• Linker
• Incremental linking for static libraries
• Algorithmic improvements
• LTCG & PGO
• Fast LTCG
• PGO instrumented builds has lower overhead
• General algorithmic improvements
across tools
Build Throughput Improvements
958 595 57
71
(7%)
285
(48%)
39
(68%)
K INE C T SPO RT S RIV AL C H RO ME O GRE 3D
INCREMENTAL BUILD (SEC)
VS2013 VS2015
715 2417508
(71%)
1480
(61%)
O GRE 3D BING (ST AT IC LIB)
FULL BUILD (SEC)
VS2013 VS2015
55. C++
• Messenger
• Facebook
• Pandora Radio
• Instagram
• Minecraft
• Snapchat
• Spotify Music
• Du Speed Booster
• Twitter
• The Game of Life
• Super Bright LED FlashLight
• Soda Saga
• Skype – Free
• Whatsapp Messenger
• Clean Master
• Netflix
• Kik
• Crossy Road
• Clash of Clans
• Amazon Shopping
• Candy Crush e IM and Video Calls
• 8 Ball Pool
• Glass Tower
• Subway Surfers
• Pinterest
• Cooking Fever
• Zedge Ringtones and Wallpaper
• Word Academy
• Poshmark - Buy and Sell
• Candy Crush Saga
• Dragon Blaze
• Marvel Future Fight
• Emoji Keyboard
• DU Battery saver
• SoundCloud - Music and Radio
• Monopoly
• Twitter
• CM Security Antivirus
• Slots - Journey of Magic
• Yahoo Mail - Free Email App
• iHeart Radio - Radio and Music
• Temple Run 2
• Boom Beach
• Despicable me
• ebay
• Wish - shopping made fun
• Trivia Check
• Juice Jam
• Game of War - Fire Age
• TouchPal Keyboard
• Geometry Dash Lite
• Flow Free
• Bird Climb
• Coin Dozer
• Uber
• Google Earth
• Flow Free
• Bird Climb
• Coin Dozer
• Uber
• Google Earth
• Archery Master 3d
• Go Keyboard - Emoji
• ooVoo video call
• Inbox by Gmail
• Samsung Smart Switch Mobile
• Tango - Free video call and chat
• Earn to Die 2
• Fruit Ninja Free
• Farm Heroes Saga
• Wallapop
• Capital One Wallet
• Truck Driver 3d: offroad
• Solitare
• Plants vs Zombies
• Hidden Object - Marrinotes
• Tinder
• DropBox
• Hulu
• Extreme Car driving simulator
• The Sims 3
• Word Search
• Hidden Object - Marrinotes
• Tinder
• Hulu
• Extreme Car driving simulator
• Need for Speed Most Wanted
• Angry Birds
• Shazam
• MyRadar Weather Radar
• Vine
• Line: Free calls and messages
• Waze Social GPS Maps
• Google Translate
• Don't tap the white tile
• Panda Pop
• EA Sports UFC
• Flipagram
• Hill Climb Racing
• Tasty Tale - The Cooking Game
• Yelp
• Offer Up - Buy, sell
• CM Launcher - Boost, Secure
• Temple Run
• Empire and Allies
• Google Docs
• Tetris
• Battery Doctor
• Beats Music
• Walmart
• Surgery Doctor
• EA FrostBite
59. Android Development Features
• Supported versions
• 4.4 “KitKat”, API Level 19
• 5.0 “Lollipop”, API Level 21
• Emulator features include
• OpenGL ES 2.0
• Multi-touch gestures
• Advanced camera simulation
• WiFi network simulation
• Debug directly from Visual St
udio
• Integrated LogCat viewer
• Natvis debugger visualizations
• Externally built native activity a
pps
• Can attach to running APKs
• “Stripped” debugging to reduc
e deployment size
• Deploy, Debug directly from V
Studio. Emulator or devices.
60. iOS Development Features
• Supports versions 6, 7, and 8 • Debug directly from Visual St
udio
• Need a Mac connected depl
oy and debug on devices onl
y (no emulator)
61. Universal Windows Platform
Development
• Develop one app for all Wi
ndows 10 devices
• Apps automatically switch be
tween desktop, phone, tablet
, Xbox and Surface Hub confi
gurations to fit screen size a
nd input types
• Unified app store
• Design your UI in XAML with
WYSIWYG editor
• You can use C++, C#, VB, or
HTML/JavaScript
• Easily port Android and iOS
apps
62. Vectorization of control flow
• Vectorization of loops with if-then-else
void blackscholes(float* input, int *signArray, int n) {
for (int i = 0; i < n; i++) {
float InputX = input[i];
int sign;
if (InputX < 0.0f) {
InputX = -InputX;
sign = 1;
} else {
sign = 0;
}
input[i] = InputX;
signArray[i] = sign;
}
}
mask = InputX < 0.0f ? 0xFFFFFFFF : 0;
InputX = (mask & -InputX) | (~mask & InputX);
sign = (mask & 1) | (~mask & 0);
Optimized to branch-less code
300%+ speedup in
blackscholes benchmark
63. Better stall-forward-avoidance
• Writes to large structures followed by reads from substructure
s can lead to hardware stalls.
• New optimizations targeted at std::complex<float> and std::c
omplex<double>
• Improved code generation of VUNPCKLPD/VUNPCKLPS instru
ctions
• 40% speedup in Eigen quaternion multiplication
code
• 35% speedup in Eigen FFT code
65. Loop-if unswitching
• Improved code generation for loop-invariant control flow
for (int i = 0; i < 100; i++)
if (some_invariant_condition)
...
Source code:
if (some_invariant_condition)
for (int i = 0; i < 100; i++)
...
Optimized as if:
Hits often, especially when considering
inlining
66. Other code generation
improvements
• #pragma loop(ivdep)
• Better vectorization of STL constructs (range based for-loops, std
::vector)
• Vectorization under /O1 (optimize for size)
• Better codegen of std::min/std::max (200% improvement in runti
me)
• Better instruction emission for bit-test (more BT, BTC, BTR, BTS)
• Plus much more…
67. What’s next: Compiler features (conform
ance) in Updates
• No need to wait for major VS updates
• Features include:
• Safer C++
• Modules
• Await completed in Update 1 (to current proposal)
• Clang/C2
• No breaking changes by default
68. What’s next: IDE productivity and build-l
ab scenario
• More Refactorings
• VC ++ Scalability and Perf
• Build-time improvements
• Standalone Build tools
69. What’s next: Early thoughts!!
• Come talk to us about your Linux / IoT dev!
• E.g. Remote Linux debugging
• Come talk to us about what you want from VS Code for C++!
70. Resources
• VCBlog – best way to follow us
• http://blogs.msdn.com/b/vcblog/
• Channel 9 – Going Native
• https://channel9.msdn.com/Shows/C9-GoingNative
71. 감사합니다.
• MSDN Forum http://aka.ms/msdnforum
• TechNet Forum http://aka.ms/technetforum
• Ayman Shoukry: aymans@Microsoft.com
• Ulzii Luvsanbat: batul@Microsoft.com