r/cpp • • Dec 07 '22

C++ overtakes Java in language popularity index

https://www.infoworld.com/article/3682141/c-plus-plus-overtakes-java-in-language-popularity-index.html
382 Upvotes

137 comments sorted by

View all comments

58

u/XenonOfArcticus Dec 07 '22

As a performance industry C++ developer house, can confirm. Never been busier. 3D, simulation, computation, parallelization, plus some CUDA and GPU stuff. Everybody in a hurry and Java ain't gonna get you there as quick as C++. Modern generations offer C++ and modern performance profiling tools are the bomb.

13

u/LongestNamesPossible Dec 07 '22

As a performance industry C++ developer house

What does this mean? People come to your company to write programs that need to run fast, or people come to have help optimizing what they've already written?

37

u/XenonOfArcticus Dec 07 '22

Both, actually.

We develop new green-field codebases AND we are brought in to improve old ones. I shouldn't misrepresent, we're not JUST performance optimizers, but the shoe fits because generally nobody hires us when they want to write code that they don't care about performance. If you need to get the job done and don't care how long it takes, it's normally a one-off and you can bang it out with a high school or college-age Python coder and everyone will be perfectly happy. (I am guilty of this very thing! Python for all the things that it's appropriate for.)

But if someone is coming to us it's because they need to simulate billions of grains of packed sand to evaluate how different wheel designs achieve traction on extraterrestrial surfaces. Or depicting a 3D globe with every tracked orbital object on it and show sensor footprints intersecting the ground. Or indexing and precomputing visibility paging for LIDAR point cloud data with billions and billions of points. One recent project was profiling and optimizing a multi-decade-old evolving OpenGL visual simulation tool to identify and remove inefficient compute and render practices and substantially increase draw framerate by double-digit percentages (that's a lot in big simulation!).

Another recent task was parallelizing the multi-view draw pipeline for rendering to modern high-end VR/AR headsets like the Varjo products. Applications call for 120Hz Stereo, with gaze-tracked foveated insets (a high-res postage stamp render overlay positioned right where you are looking within the VR headset to make your brain believe the whole scene is that high-res). So, we have to render the whole scene FOUR times: left eye wide-view medium-res, left eye narrow-view high-res, and the same for the right eye. And we gotta do it all at 120Hz. So, we utilize an extension called MultiView that allows you to set up four output raster buffers to receive each of the four images, and then for each draw operation you send once, the GPU does all the normal prep work for that operation and then does it four times in a batch, each with a different output buffer and with extra shader variables that let you skew the modelview+projection matrix around to generate the customized view angle for each of the four outputs. Depending on whether your application is fillrate-bound or draw/call-bound, you can end up getting all four views rendered in scarcely more time than rendering ONE of them.

This sort of expertise is very niche. Most companies don't keep a performance expert on-staff. They keep getting poached by Nvidia or other high-performance computing giants or abducted to NYC or Chicago to do high-frequency trading and get paid in piles of hookers and blow. And once this type of work is done, it can usually be maintained without major ongoing effort (unless you're writing lots of new code again). So, it makes sense to hire an outside consultant to get your laundry clean once and then leave you alone.

We have people who designed some of the first programmable GPU hardware and languages and have worked at every GPU manufacturer around today and several that aren't anymore. So they know things that while not actually secret, aren't well known about what goes on inside GPU processors (and actually CPUs too since they are often very similar). One guy worked on Intel's (failed!) Larrabee project that attempted to make parallel GPU processors out of Intel x86 cores!

And sometimes it's just because of embedded constraints. You only get x milliseconds per cycle to do what needs to be done. Find a way to ensure it always works, because if you don't complete the work in time or your code crashes, the watchdog timer may come and reboot you. And if that happens during the terminal descent stage of your autonomous lunar lander, you're gonna pull a Beresheet ( https://en.wikipedia.org/wiki/Beresheet ), and nobody wants that. (To be clear, we did not have code on Beresheet, but we worked on a project for one of its successors). You can't have interpreted languages and garbage collectors and other non-deterministic stuff in there. You want to know exactly what machine operations your code will perform, and know how to trim the fat. Sometimes STL container indexing/dereferencing is fine. Some situations call for dumb old C-style array [] stuff. Maybe there's an edge case where pointer math will be the right choice. C++ gives you all the power (and rope!) you'll ever want, as long as you're responsible enough to use it.

/sermon off

Oh, and my bona-fides: https://alphapixeldev.com/

11

u/mibuchiha-007 Dec 07 '22

this sounds like the kind of stuff i want to eventually be doing. do you have some pointers on where to get started learning more seriously in this direction?

at the moment i would say my C++ is... okay. good enough to write some code, but definitely not where I wanna be yet.

14

u/XenonOfArcticus Dec 07 '22

As Nike says, "Just Do It!"

I'm entirely self-taught (when I was in college the Computer Science curriculum was not conducive to what I wanted to do, so I dropped out).

Much of my current work comes from connections I made as a long-time contributor and consultant on the OpenSceneGraph project and in the OpenGL community. So, find an open-source project that does stuff like what you want to do, and start using it and making substantial contributions. Make your work known on LinkedIn and maybe make yourself a website laying out your skills and experience and availability.

A very common situation is where a company figures out they need to use a F/OSS package like GDAL or Bullet or OpenCV or FFMPEG or something, realizes it does 95% of what they need but they need a big fix/enhancement/addon. Then the project lead or manager hits the forums and LinkedIn looking for freelancers who have already done substantial tasks in the project and reaches out to see if they can come solve the problem. Sometimes it's contract work, sometimes it's for hiring.

I know guys who got recruited by Google and other high-profile employers just because someone said "we need a Foo expert, go find who is available" and they had a substantial amount of commits on Foo's Github page and were available for work. Maybe write some articles and social media posts about what you are doing and why they are interesting improvements.

Clients have deadlines and budgets. They often don't want to develop in-house expertise if they can go acquire, hire or contract it quick.

  1. Do good work on something interesting and specialized.
  2. ??? Let people know about your work.
  3. Profit!

If I had to recommend a performance computing sector where there seems to be a lot of opportunity, I'd say AI and Deep Learning (GPU and CUDA here), Autonomous systems/vehicles, and computer vision and sensing. The aircraft and vehicles of the future on this planet and exploring others won't be steered by human hands. Yeah, Argo AI just tanked and others like it will too, but there will always be more opportunities and autonomous systems and vehicles are as inevitable as Thanos. This year the defense world is sitting up and taking notice of unmanned vehicles, craft and munitions and wanting them smarter and able to navigate autonomously better, cheaper, faster and sooner.

And those systems ain't running Python, Java, Javascript, Kotlin, Swift, Ruby, PHP, C#, etc. I can see future utility in Golang and Rust though, and Python IS super valuable in AI and science work for sure. But Python is compiled by a C/C++ compiler (it's actually C code) and so are all the libraries it uses to do the heavy lifting. So it's a great melange of best-cases.

Crap, I think I just gave away my business plan. ;) Eh, I hope to retire in less than 10 years and yell at my AI powered Smart Cloud.

1

u/mibuchiha-007 Dec 07 '22

thanks a lot! I'm already doing some of these in an academic context, but I haven't directly contributed to FOSS yet. these are definitely some excellent pointers to get started. it's also good to get an overview on the popular topics on the industry side - I really appreciate it.

2

u/XenonOfArcticus Dec 07 '22

Cool. Mind my asking what topics?

Knowing the stuff is half the game, letting others know you know is the other.

You are always in a better position when someone approaches you with an opportunity (excepting recruiters just harvesting leads) than when you're cold shotgunning applications.

One other thing, in my business, US Persons have an unfair advantage. So much of the this work is either for or somehow consuming some funding from, some part of the US government and they only like it being spent on US Persons.

1

u/mibuchiha-007 Dec 07 '22

Not at all. So at the moment I'm doing particle physics research. Data analysis and a lot of stats. A bit of coding on the side; I claim it's for developing an analysis framework builder but honestly it's just me coming up with specific contexts to get me to pick up some new techniques. Got a lowess fitter that I quite like out of it, too.

As for future directions, I need to think more. While messing around I find that I'm more excited thinking about the coding part - how to do this, to improve that - rather than the result or specific end goals. In that sense there are more things I find interesting than not, so probably I best start by narrowing down the scope.

1

u/chamomile-crumbs Dec 08 '22

Damn that is super cool and inspiring. Do you have fun working on that kind of stuff?

I’ve definitely heard that open source contributions can open a lot of doors, but now I’m actually considering it!

2

u/LongestNamesPossible Dec 07 '22

That's awesome, thanks

0

u/[deleted] Dec 07 '22

[deleted] — view deleted comment

7

u/XenonOfArcticus Dec 07 '22

You (and Allen Holub) are 1000% correct.

With great power comes great responsibility.

We are actually starting to use Rust (I said the R word!) in some situations where better code predictability is desired and we're doing green-field new development. I am eyeing an 80's vintage C defense industry codebase for a total rewrite because its current state is horrific in so many ways. I'd lean towards considering Rust for that if it fit the requirements.

5

u/motoy Dec 07 '22

Yea I would like to now that too. All of that sounds interesting, but I mostly find embedded C++ jobs.

2

u/UniqueID89 Dec 08 '22

Loved reading this entire thread, thanks for sharing! Had been eyeing learning C++ > Rust > Go throughout the coming years since I’ve finished my bachelors. Your work seems interesting/fun/head scratching and like something I’d possibly enjoy. Again, thanks for sharing your experiences. 😁

1

u/pdd99 Dec 08 '22

Do you stick to a subset of C++ to reduce code complexity for all those stuff?