What’s new in C++ in vNext - · PDF file · 2012-10-25The new relevance of...

46

Transcript of What’s new in C++ in vNext - · PDF file · 2012-10-25The new relevance of...

renaissance (n.) 1. a movement or period of vigorous artistic and

intellectual activity

2. rebirth, revival

The new relevance of

cross-platform

Experience expectation

Hardware evolution

New productivity

gains

Mobile devices

Graphics,

physics, touch,

gesture

GPU, vector,

sensors

C++11, modern

tools, perf-

orientation

0 20 40 60 80 100 120 140 160

18

21

24

27

30

33

36

39

42

45

48

51

54

57

60

63

66

69

75

80

84

88

92

COUNT

AG

E

0% 10% 20% 30% 40% 50% 60%

10+ years

5-9 years

0-4 years

Gaming, 20%

Engr/Science,

15%

Frameworks,

12% Business,

10% Embedded, 8%

Productivity,

8%

Imaging, 7%

Content, 7%

Other, 13%

• Windows Phone 8: Finally, C++!

The new relevance of

cross-platform

Mobile devices

Communication

& Data

Devices

& Printing

WinRT APIs

Graphics

& Media

Desktop apps

C

C++

Win32

C#

VB

.NET

SL

HTML JavaScript

Internet Explorer

Windows Store style apps

Application Model

XAML

JavaScript

HTML / CSS

C

C++

C#

VB

Windows Kernel Services

Syst

em

Serv

ices

Vie

w

Mo

del

Co

ntr

oller

Kern

el

DX

The new relevance of

cross-platform

Mobile devices

The new relevance of

cross-platform

Mobile devices

Experience expectation

Graphics, physics, touch,

gesture

Experience expectation

Graphics, physics, touch,

gesture

Experience expectation

Graphics, physics, touch,

gesture

Experience expectation

Graphics, physics, touch,

gesture

Experience expectation

Graphics, physics, touch,

gesture

1975-2005

Put a computer on

every desk, in every

home, in every

pocket.

2005-2011

Put a parallel

supercomputer on

every desk, in every

home, in every

pocket.

2011-201x

Put a heterogeneous local &

distributed parallel

supercomputer on every

desk, in every home,

in every pocket.

Welcome to the jungle

The free lunch is so over

Hardware evolution

GPU, vector, sensors

Hardware evolution

GPU, vector, sensors

+

r1 r2

r3

add r3, r1, r2

SCALAR

(1 operation)

v1 v2

v3

+

vector

length

vadd v3, v1, v2

VECTOR

(N operations)

Hardware evolution

GPU, vector, sensors

B[0] B[1] B[2] B[3]

A[0] A[1] A[2] A[3]

A[0] + B[0] A[1] + B[1] A[2] + B[2] A[3] + B[3]

+ xmm1

xmm0

“addps xmm1, xmm0 “

xmm1

Hardware evolution

GPU, vector, sensors

for (i = 0; i < 1000; i++)

{

C[i] = A[i]+B[i]

}

for (i = 0; i < 1000; i+=4)

{

C[i:i+3] = A[i:i+3]+B[i:i+3]

}

Hardware evolution

GPU, vector, sensors

Hardware evolution

GPU, vector, sensors

// composing with order dependencies task<void> a([=]() {DoSomething();}); a.then([=]() {DoSomethingElse();)); // choice & join auto t = t1 || t2; // same as when_any auto t = t1 && t2; // same as when_all

performance

portability

productivity

Hardware evolution

GPU, vector, sensors

CPU Compiler support for Auto-Vectorization

Compiler support for Parallelization

Richer PPL, incl. more algorithms & async tasks

GPU - C++ AMP STL-like library for multidimensional data

VS IDE support incl. Profiler, Debugger

Builds on Direct3D

Compile with /GL &

Optimizations On (e.g. /O2) Source Object files

Instrumented Image

Scenarios Output Profile data

Object files Link with /LTCG:PGI Instrumented

Image

Profile data

Object files

Link with /LTCG:PGO Optimized

Image

Profile Guided Optimization

►Profile Guided uses call graph path profiling.

foo

bat

bar baz

a

100

foo

bat

20 50

bar baz

15 bar

baz a 10 75

bar

baz 15

foo

bat

20 125

bar baz

100 15

bar baz

a 10

15

if (i == 10) goto default; switch (i) { case 1: … case 2: … case 3: … default:… }

Most frequent values are pulled out.

switch (i) { case 1: … case 2: … case 3: … default:… }

// 90% of the // time i = 10;

A

C B

D

100

100

10

10

A

B

C

D

Default layout

A

B

C

D

Optimized layout

Basic blocks are ordered so that most frequent path

falls through.

Basic Block 1

Cond

Cold Code Hot Code

More Code

Basic Block 1

Cond

Cold Code Hot Code

More Code

Hot path is inlined,

but NOT the cold

New productivity

gains

C++11, modern tools,

perf-orientation

C++ 11 ISO C++ standard features

Library Support <atomic>,<chrono>,<condition_variable>, <filesystem>,<future>,<mutex>,<ratio>, <thread>

C++11 Core Language

Features VS 2010 VS 2012

Rvalue references v2.0 v2.1*

Lambdas v1.0 v1.1

decltype v1.0 v1.1

auto v1.0 v1.0

static_assert Yes Yes

Trailing return types Yes Yes

nullptr Yes Yes

Strongly typed enums Partial Yes

Forward declared enums No Yes

Standard-layout and trivial types No Yes

Atomics No Yes

Strong compare and exchange No Yes

Bidirectional fences No Yes

Data-dependency ordering No Yes

Range Based for loops No Yes

Independent “SCARY” iterators No Yes

Projects & Solutions Backwards compatibility

Browse from Solution Explorer

Window Management Pin & Preview

Multi-mon

Search everywhere Search across the IDE.

Search in tool windows.

Improved Colorization Improves code understanding

Reference Highlighting Uses the compiler to show accurate matches

Improves code understanding.

IntelliSense Aggressive Member list

Member list filtering

C++/CLI support.

Code Snippets

New productivity

gains

C++11, modern tools,

perf-orientation

What’s next? Continuing the Renaissance

C++ 개발자를 위한 Visual Studio 2012 세미나

10월 16일 (화) 13:00 – 18:10 양재동 L 타워 그레이스 홀