October 01, 2014
On Wednesday, 1 October 2014 at 14:16:38 UTC, bearophile wrote:
> Max Klyga:
>
>> https://www.youtube.com/watch?v=TH9VCN6UkyQ
>
> A third talk (from another person) about related matters:
> https://www.youtube.com/watch?v=rX0ItVEVjHc
>
> He doesn't use RTTI, exceptions, multiple inheritance, STL, templates, and lot of other C++ stuff. On the other hand he writes data-oriented code manually, the compiler and language give him only very limited help, and the code he writes looks twiddly and bug-prone. So why aren't they designing a language without most of the C++ stuff they don't use, but with features that help them write the data-oriented code they need?
>
> Bye,
> bearophile

 He (deliberately I'd guess)conflates cache friendly data structures and access patterns with his particular preference for a C style.

 It is a fallacy that he presents as fact.

 The key to these type of fast code isn't the C style, it is the contiguous data layout, and cache friendly access patterns, both of which are easily enough to perform in modern C++.

October 01, 2014
On Wednesday, 1 October 2014 at 15:17:33 UTC, po wrote:
> On Wednesday, 1 October 2014 at 14:16:38 UTC, bearophile wrote:
>> Max Klyga:
>>
>>> https://www.youtube.com/watch?v=TH9VCN6UkyQ
>>
>> A third talk (from another person) about related matters:
>> https://www.youtube.com/watch?v=rX0ItVEVjHc
>>
>> He doesn't use RTTI, exceptions, multiple inheritance, STL, templates, and lot of other C++ stuff. On the other hand he writes data-oriented code manually, the compiler and language give him only very limited help, and the code he writes looks twiddly and bug-prone. So why aren't they designing a language without most of the C++ stuff they don't use, but with features that help them write the data-oriented code they need?
>>
>> Bye,
>> bearophile
>
>  He (deliberately I'd guess)conflates cache friendly data structures and access patterns with his particular preference for a C style.
>
>  It is a fallacy that he presents as fact.
>
>  The key to these type of fast code isn't the C style, it is the contiguous data layout, and cache friendly access patterns, both of which are easily enough to perform in modern C++.

OOP style and AoS in general does cause cache unfriendly data access. You can separate out your hot and cold data but at that point you're not really programming in an OO style. He doesn't use RTTI, templates, exceptions, etc. for different reasons than cache friendliness.

At what point does he say it's difficult to code in a SoA style in C++? He clearly states he sees no advantage to C++ over C.
October 01, 2014
I certainly believe C++ style and it's community promote the idea of zero overhead abstractions and the kind of OOP style which _does_ cause cache misses.

October 01, 2014
currysoup:

> At what point does he say it's difficult to code in a SoA style in C++?

Perhaps a (part of) language more fit/helpful/nice for that purpose/use can be invented.

Bye,
bearophile
October 01, 2014
On Wednesday, 1 October 2014 at 14:16:38 UTC, bearophile wrote:
> Max Klyga:
>
>> https://www.youtube.com/watch?v=TH9VCN6UkyQ
>
> A third talk (from another person) about related matters:
> https://www.youtube.com/watch?v=rX0ItVEVjHc
>
> He doesn't use RTTI, exceptions, multiple inheritance, STL, templates, and lot of other C++ stuff. On the other hand he writes data-oriented code manually, the compiler and language give him only very limited help, and the code he writes looks twiddly and bug-prone. So why aren't they designing a language without most of the C++ stuff they don't use, but with features that help them write the data-oriented code they need?

Probably because C++ is good enough and already has mature infrastructure.
October 01, 2014
Am 01.10.2014 17:40, schrieb currysoup:
> I certainly believe C++ style and it's community promote the idea of
> zero overhead abstractions and the kind of OOP style which _does_ cause
> cache misses.
>

C++ does not imply OOP.

And the zero overhead abstractions are a culture heritage from C as it was the only way to sell C++ to most C developers.


--
Paulo
October 01, 2014
> OOP style and AoS in general does cause cache unfriendly data access. You can separate out your hot and cold data but at that point you're not really programming in an OO style. He doesn't use RTTI, templates, exceptions, etc. for different reasons than cache friendliness.

 Modern C++ != OO style.

I'd say modern C++ is more generic + functional than OO.

He seems to think C++ is about programming in some sort of Java design pattern inspired way.

> At what point does he say it's difficult to code in a SoA style in C++? He clearly states he sees no advantage to C++ over C.

1. He references Design patterns during his tirade against C++, who the hell uses design patterns in C++ these days?
2. He uses Ogre, a 15 year old terrible mess of a rendering engine, written in a nasty Java style, as an example of why C++ is bad



October 01, 2014
On Wednesday, 1 October 2014 at 15:40:59 UTC, currysoup wrote:
> I certainly believe C++ style and it's community promote the idea of zero overhead abstractions and the kind of OOP style which _does_ cause cache misses.

 Take a look at the STL. See any OOP? Right cause there isn't any.
 Boost? Nope.

 C++ jumped off the OOP bandwagon some time ago.


October 01, 2014
> Perhaps a (part of) language more fit/helpful/nice for that purpose/use can be invented.
>
> Bye,
> bearophile

 It isn't as hard as he pretends to write SoA code in C++. In fact it is possible to abstract the underlying data you are operating on, and replace it with vector type

Example resembling his butt ugly code: operates only on 1 float at a time
struct Vec2{
  float x,y;
};
void Add2(Vec2* points, int howMany){
  for(int i = 0;i<howMany;++i){
     points[i].x += 2.0f;
     points[i].x += 2.0f;
   }
}

How I would do it, uses AVX256:

template<class T>
struct Vec2{
  T x,y;
};
typedef Vec2<float8> vec2_8f;

//float8 is a wrapper around AVX256 8 wide float type that behaves exactly like a //normal float but is actually 8 floats.

void Add2(range<vec2_8f> points){
  for(auto& p:points){
    p += 2.0f;
  }
}

C++ can abstract away the fact that float8 is actually implemented using a bunch of AVX intrinsics. Using his approach he'd be manually writing intrinsics until the cows came home.

October 01, 2014
Am 01.10.2014 23:03, schrieb po:
>
>> OOP style and AoS in general does cause cache unfriendly data access.
>> You can separate out your hot and cold data but at that point you're
>> not really programming in an OO style. He doesn't use RTTI, templates,
>> exceptions, etc. for different reasons than cache friendliness.
>
>   Modern C++ != OO style.
>
> I'd say modern C++ is more generic + functional than OO.
>
> He seems to think C++ is about programming in some sort of Java design
> pattern inspired way.

If he is stuck in the late 90's/early 2000's, yes.

>
>> At what point does he say it's difficult to code in a SoA style in
>> C++? He clearly states he sees no advantage to C++ over C.
>
> 1. He references Design patterns during his tirade against C++, who the
> hell uses design patterns in C++ these days?

Those architects, specially the CORBA ones, are nowadays doing J2EE and WPF MVVM applications.

And the original design patterns were actually targeted at Smalltalk, with C++ on the side as the language was started to get popular in the industry.

> 2. He uses Ogre, a 15 year old terrible mess of a rendering engine,
> written in a nasty Java style, as an example of why C++ is bad
>
>
>

I never liked Ogre. A strange mix of OO with too much low level C like stuff still.

At least when I looked at it a few years ago.

--
Paulo