efficiency

Native Code Performance on Modern CPUs: A Changing Landscape -- Eric Brumer

eric-brumer-build-2014.PNGThis C++ optimization talk is one of the highest-rated talks from last week's //build/ conference, and deservedly so.

Be prepared for deep content from a compiler optimizer architect, and quite a bit of subtle dry humor.

Native Code Performance on Modern CPUs: A Changing Landscape

by Eric Brumer
Compiler developer, Visual C++ team

Modern CPUs are fast. Really fast. New instructions, wider vector registers, and more powerful CPUs promise faster code. But reasoning about performance is not as it seems on the surface. This talk will dive deep into how advancements in the latest chips force some rethinking of native code performance, from the point of view of a compiler developer. The performance landscape is changing. Come see what that means.

Modern C++: What You Need to Know -- Herb Sutter

A recording of yesterday's //build/ talk by Herb Sutter is now available on Channel 9:

Modern C++: What You Need to Know

by Herb Sutter

This talk will give an update on recent progress and near-future directions for C++, both at Microsoft and across the industry. This is a great introduction to the current state of the language, including a glimpse into the future of general purpose, performance-intensive, power-friendly, powerful native programming.

From the advance description on Herb's blog:

I was asked to give a "foundational talk" about C++, and I decided that meant I should focus on addressing two questions that I get a lot these days:

  • FAQ #1 (1-2 slides): When should I use C++ compared to another language -- on all platforms in general, and on Microsoft platforms in particular?
  • FAQ #2 (lots of slides): What should I know about C++ if I’m a {Java|C#|JavaScript|Python|...} developer?

Even if you're a seasoned C++ developer, there are some nuggets and data points in the middle of the talk that I think you will find useful in your own work...

CppCon 2014 Registration Open: September 7-12, Bellevue, WA, USA

cppcon-173.PNGThe Standard C++ Foundation is very pleased to announce the first annual CppCon.

cppcon-logo.PNG

Registration is now open for CppCon 2014 to be held September 7–12, 2014 at the Meydenbauer Center in Bellevue, Washington, USA. The conference will start with the keynote by Bjarne Stroustrup titled "Make Simple Tasks Simple!"

CppCon is the annual, week-long face-to-face gathering for all C++ users. The conference is organized by the C++ community for the community. You will enjoy inspirational talks and a friendly atmosphere designed to help attendees learn from each other, meet interesting people, and generally have a stimulating experience. Taking place this year in the beautiful Seattle neighborhood and including multiple diverse tracks, the conference will appeal to anyone from C++ novices to experts.

What you can expect at CppCon:

  • Invited talks and panels: The CppCon keynote by Bjarne Stroustrup will start off a week full of insight from some of the world’s leading experts in C++. Still have questions? Ask them at one of CppCon’s panels featuring those at the cutting edge of the language.
  • Presentations by the C++ community: What do embedded systems, game development, high frequency trading, and particle accelerators have in common? C++, of course! Expect talks from a broad range of domains focused on practical C++ techniques, libraries, and tools.
  • Lightning talks: Get informed at a fast pace during special sessions of short, less formal talks. Never presented at a conference before? This is your chance to share your thoughts on a C++-related topic in an informal setting.
  • Evening events and “unconference” time: Relax, socialize, or start an impromptu coding session.

CppCon’s goal is to encourage the best use of C++. The conference is a project of the Standard C++ Foundation, a not-for-profit organization whose purpose is to support the C++ software developer community and promote the understanding and use of modern, standard C++ on all compilers and platforms.

Range Concepts, Part 1 of 4: Delimited Ranges

The start on a series about ranges from Eric Niebler:

Range Concepts, Part 1 of 4: Delimited Ranges

By Eric Niebler

From the Article:

I’ve been digging into ranges recently, and I’m finding them to be more than just a pair of iterators. In a series of posts, I’ll be expanding the notion of what a range is to cover some kinds of ranges not easily or efficiently expressible within the STL today: delimited ranges and infinite ranges. This post deals with the problems of representing delimited ranges with STL iterators.

Ode To a Flat Set -- Jon Kalb

Grecian-Urn-187x300.jpegA nice short overview of when you might want your associative container to use a contiguous implementation instead of a tree under the covers:

Ode to a Flat Set

by Jon Kalb

From the article:

The Boost Container library has a family of flat_* containers that have associative container interfaces and semantics, but are implemented as sorted vectors.

In addition to faster lookup, the flat_* containers have much faster iteration, less memory overhead, fewer allocations, and improved cache performance.

However, as with all things, there are trade-offs.

Out Parameters, Move Semantics, and Stateful Algorithms -- Eric Niebler

In this article, Eric Niebler discusses an issue of API design regarding the age-old question of out parameters versus return-by-value, this time in light of move semantics. He uses std::getline as his example.

Out Parameters, Move Semantics, and Stateful Algorithms

by Eric Niebler

From the article:

I think getline is a curious example because what looks at first blush like a pure out parameter is, in fact, an in/out parameter; on the way in, getline uses the passed-in buffer’s capacity to make it more efficient. This puts getline into a large class of algorithms that work better when they have a chance to cache or precompute something.

 

Double-Checked Locking Is Fixed in C++11 -- Jeff Preshing

preshing.PNGJeff Preshing gives a nice overview of the on-again/off-again/on-again status of a common approach to lazy initialization.

[Ed: Note that DCLP is not just for thread-safe singletons, that's just a handy example. It's for lazy initialization in general.]

Double-Checked Locking Is Fixed in C++11

by Jeff Preshing

From the article:

The double-checked locking pattern (DCLP) is a bit of a notorious case study in lock-free programming. Up until 2004, there was no safe way to implement it in Java. Before C++11, there was no safe way to implement it in portable C++.

As the pattern gained attention for the shortcomings it exposed in those languages, people began to write about it. In 2000, a group of high-profile Java developers got together and signed a declaration entitled “Double-Checked Locking Is Broken”. In 2004, Scott Meyers and Andrei Alexandrescu published an article entitled “C++ and the Perils of Double-Checked Locking”. Both papers are great primers on what DCLP is, and why, at the time, those languages were inadequate for implementing it.

All of that’s in the past. Java now has a revised memory model, with new semantics for the volatile keyword, which makes it possible to implement DCLP safely. Likewise, C++11 has a shiny new memory model and atomic library which enable a wide variety of portable DCLP implementations. C++11, in turn, inspired Mintomic, a small library I released earlier this year which makes it possible to implement DCLP on some older C/C++ compilers as well.

In this post, I’ll focus on the C++ implementations of DCLP...

Papers for Chicago: Concurrency

The start of my series about the papers for the upcoming Chicago meeting, starting with C for Concurrency:

C++ Papers for Chicago: Part 1 -- Concurrency

by Jens Weller

From the article:

As I did write a series about the papers for Bristol, this is the start of the series for Chicago, as at the end of this month the C++ committee will meet again for standardization. I try to...

C++ String to Int -- Ivan Neeson

kumobius.PNGA nice comparison on converting a string to int:

C++ String to Int

by Ivan Neeson

From the article:

In this post I will compare the following methods for parsing a string into an integer in C++:

  • Manually
  • atoi()
  • strtol()
  • sscanf()
  • std::stoi (C++11 only)
  • std::istringstream
  • Boost.LexicalCast
  • Boost.LexicalCast with C locale
  • Boost.Spirit.Qi
  • Boost.Coerce

But first lets look at the requirements...