56 points

It’s amazing what modern game engine’s can render. That looks almost real, kudos to the creators

permalink
report
reply
8 points

It’s fine but have you seen starfield?

permalink
report
parent
reply
10 points

*chef’s kiss, followed by vomiting*

permalink
report
parent
reply
36 points

C++ is fiiiiine. Just use the modern variant of the language, don’t bother with hand-optimizing your memory allocators, and generally avoid anything involving pointer arithmetics. So, basically, use it like you would use Python.

permalink
report
reply
10 points

So, basically, use it like you would use Python.

That’s a great way to get performance as shitty as python’s.

permalink
report
parent
reply
42 points

C++ can do a lot of things but one thing it can’t do is perform as poorly as python.

permalink
report
parent
reply
17 points

permalink
report
parent
reply
5 points

Cython

permalink
report
parent
reply
4 points

Not quite, but smart pointers in the wrong location can be quite wasteful in terms of CPU cycles.

permalink
report
parent
reply
16 points

This is a very “yes but still no” thing in my experience. Typically, I find that if I write “naive” C++ code, where I make no effort to optimise anything, I’ll outperform python code that I’ve spent time optimising by a factor of 10-30 (given that the code is reasonably complex, this obviously isn’t true for a simple matrix-multiplication where you can use numpy). If I spend some time on optimisation, I’ll typically be outperforming python by a factor of 50+.

In the end, I’ve found it’s mostly about what kind of data structures you’re working with, and how you’re passing them around. If you’re primarily working with arrays of some sort and doing simple math with them, using some numpy and scipy magic can get you speeds that will beat naive C++ code. On the other hand, when you have custom data structures that you want to avoid unnecessarily copying, just rewriting the exact same code in C++ and passing things by reference can give you massive speedups.

When I choose C++ over python, it’s not only because of speed. It’s also because I want a more explicitly typed language (which is easier to maintain), overloaded functions, and to actually know the memory layout of what I’m working with to some degree.

permalink
report
parent
reply
5 points

I guess I should have clarified in my original comment that I was exaggerating - obviously, C++ doesn’t get as bad as python, not even into the same ballpark.

My emphasis was on “don’t use C++ like you would python” because that’s not good advice imo.

permalink
report
parent
reply
29 points

I love C++ I love C++ I love C++ I love C++

>does big something with C++

I hate C++ I hate C++ I hate C++ I hate C++

permalink
report
reply
5 points

Honestly that’s most things in life.

The more complex your project, the more likely you are to run into the rough patches or quirks of whatever it is you’re working with.

permalink
report
parent
reply
19 points

I also enjoyed this album by Incubus.

permalink
report
reply
7 points

I wish you were here.

permalink
report
parent
reply
6 points

Animals

permalink
report
parent
reply
4 points

A Momentary Lapse of Reason

permalink
report
parent
reply
-1 points

Drive

permalink
report
parent
reply
1 point

What programming language is Afungus Amongus?

permalink
report
parent
reply
18 points

It’s so we can recreate that, but with like laser beams and stuff.

permalink
report
reply
7 points

When you first saw C++ were you blinded by its majesty?

permalink
report
parent
reply
2 points

(with lasers): “How about now?”

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 5.3K

    Monthly active users

  • 1.5K

    Posts

  • 33K

    Comments