Basεd

basεd

Attached: john_travolta.png (851x567, 50K)

Other urls found in this thread:

en.cppreference.com/w/cpp/string/byte/toupper
en.cppreference.com/w/cpp/experimental/fs
twitter.com/NSFWRedditGif

based, but somehow still bluepilled

Ok now make a game in python.

12fps at 640x360 here we go

Use the right tool for the right job. If you're writing an application where performance is critical, do it in C++.

That's only if running the program actually blocks him from doing anything else.

Programs that function are written in C

Scripts that function are written in Python

Programmers who get it twisted are written in retard

If he knew he'd get massive performance benefits from running it in a low level language, then he should've done that from the fucking start.

idiot.

Sir do you have a problem with java?

calm down bruce

Writing Rust is faster than writing Python if you're not a retard. The problem with C++ wasn't that you had to manage memory manually but rather that the standard library sucked dick.

i rewrote a python script in go and thought it was faster, turned out i was stat()ing extra by accident in the python version, fixed it and it was the same speed

Why not spend 1 hour rewriting it in python?

Programs that function are written in C

Applications that function are written in C++

Scripts that function are written in shell

Programmers who write Python have peanut brains

>The problem with C++ wasn't that you had to manage memory manually but rather that the standard library sucked dick.
Neither of these things are true with modern C++. The only problem with C++ is that you have to learn what you should use and what you shouldn't use, but it's great after you pass that initial step.

Just let it die

std::string is severely lacking which is what you'll be using 90% of the time in simple Python-tier programs

Name something it's missing.

do illuminate me please, currently starting out with c++ and id like to avoid unnecessary bumps

tell me how to convert a std::string to uppercase without googling (bonus points for unicode support)

subtract the ascii code of the upper case letter

>Neither of these things are true with modern C++.
standard library still sucks dick and always will

en.cppreference.com/w/cpp/string/byte/toupper

> Applications that function are written in C++
> Scripts that function are written in shell
Yeah given the choice, who wouldn't choose a nuclear, dried cucumber over a hammer when it comes to hitting a nail into the wall? The nuclear, dried cucumber is much harder and cooler, hear me out guys!

also: filesystem access, easy built in package management, good safe way of doing formatting
a) what would the code for that look like?
b) that would break UTF-8 strings
that's for characters, not strings

>filesystem access
en.cppreference.com/w/cpp/experimental/fs

>built in package management
This is not a feature. Use the package manager of your distro.

>good safe way of doing formatting
Elaborate what you mean by this.

>that's for characters, not strings
There's an example of using it on strings.

>a) what would the code for that look like?

quick python code
>>> s
'test'
>>> l = ''.join([chr(ord(i)-32) for i in list(s)])
>>> l
'TEST'

>experimental
will this work with GCC 9.1.0 without me doing anything?
>This is not a feature. Use the package manager of your distro.
well, cargo works great and we were comparing it to python
>Elaborate what you mean by this.
like printf but it makes sure a) you gave the right amount of arguments and b) whatever input you gave in can actually be formatted
>There's an example of using it on strings.
which you had to google, so you lost

i meant for C++, both rust and python has this built in as a one liner
this is why C++ isn't great for small utility programs

Maybe he wrote the python version when he was still a larval-stage programmer who was googing "how to program"

>will this work with GCC 9.1.0 without me doing anything?
Read the very top of the page.
>The functionality described on this page was merged into the mainline ISO C++ standard as of 3/2016; see the filesystem library (since C++17)

>well, cargo works great and we were comparing it to python
I don't care. Language package managers are dumb. It's the job of your distro to package libraries.

>like printf but it makes sure a) you gave the right amount of arguments and b) whatever input you gave in can actually be formatted
I don't see how std::cout doesn't satisfy this.

>which you had to google, so you lost
The example is in the official documentation on the same page. No googling needed. Just check the docs.

>I don't care. Language package managers are dumb. It's the job of your distro to package libraries.
This is the most retarded thing I've read today

I don't want to fumble around with a million different package managers. I want just one command to update all of my shit.

>Read the very top of the page.
>(since C++17)
is C++17 enabled by default? mind you it's easy to find out but it's dumb that it took until 2017 for something as simple as filesystem access
>I don't care. Language package managers are dumb. It's the job of your distro to package libraries.
the whole point was that you can replace python with rust, just because you think it's dumb doesn't mean it's not a valuable feature to have
also what if you need a package that's not in your distro's package manager?
>I don't see how std::cout doesn't satisfy this.
what if i want to output to a string? what if i want to have at most 2 decimal places in a float? what if i want to print a whole structure for debugging?
>The example is in the official documentation on the same page. No googling needed. Just check the docs.
if i have to check the docs just to uppercase a string and essentially reimplement it every time then your standard library is not sufficient
C# can do it in one line, python can, rust can, java can, etc
also the "official" C++ solution still doesn't work with UTF-8

>is C++17 enabled by default? mind you it's easy to find out but it's dumb that it took until 2017 for something as simple as filesystem access
No you have to set a flag, but any serious C++ project would involve some kind of build system anyway so this isn't a real problem. I agree that it is silly that it took until 2017 to get filesystem access, but it exists now and it works.

>also what if you need a package that's not in your distro's package manager?
Then I'd package it myself.

>what if i want to output to a string? what if i want to have at most 2 decimal places in a float? what if i want to print a whole structure for debugging?
Output to a string: std::stringstream
Decimal precision: std::setprecision

>Print a whole structure
I will grant you that this doesn't exist.

>if i have to check the docs just to uppercase a string and essentially reimplement it every time then your standard library is not sufficient
Nobody remembers the standard library for everything. If you use it enough, you will remember it. There is nothing wrong with looking at documentation. Programming isn't about memorization.

>also the "official" C++ solution still doesn't work with UTF-8
Probably true. I will grant you this as well.

Fuck off shill

>No you have to set a flag, but any serious C++ project would involve some kind of build system anyway so this isn't a real problem
the great thing about rust is that it has one build system that just works for everything (including typical C++ pains like cross-compilation, switching language versions and generating documentation)
>Then I'd package it myself.
that would take way too much effort for a small utility program that only you are going to use
if i had to choose between that and typing pip install i'd go back to python
>Output to a string: std::stringstream
>Decimal precision: std::setprecision
those are fine except that they're a little verbose, i'll give you that
>I will grant you that this doesn't exist.
desu i don't know if python has it either, it's just a neat little thing you can do in rust
>There is nothing wrong with looking at documentation
obviously but i still think the C++ STL is lacking

>intel and nvidia shills now working for python

If you run it once a day and it only takes 1.5 seconds to run, why would you ever rewrite it?
I think that is very much the point of the tweet: albeit his program is now 25x faster, when you consider the time it took for him to rewrite it and just how much time this refactoring actually saves him, the result is a massive loss of his time.
Programmer time is much, much more valuable than shaving off 1.44 seconds of execution time. Write in higher level languages and don't optimize for performance unless you HAVE to.

Attached: wHVHjd4h_400x400--elonbtw.jpg (400x400, 25K)

Yes that's reasonable but what if you have principles to abide by?

Honestly he was probably bored at work but wasn't allowed to leave early.

>the great thing about rust is that it has one build system that just works for everything (including typical C++ pains like cross-compilation, switching language versions and generating documentation)
How well does this work with meson though? Meson is honestly by far my favorite build system and almost everything else became terrible after I started using it.

>that would take way too much effort for a small utility program that only you are going to use
Well you shouldn't be adding libraries for one little thing in the first place. When you add a library to your program, you should be calling it often somewhere to justify its inclusion.

>obviously but i still think the C++ STL is lacking
To be honest, I never have to worry much about character encoding, but it is true that C/C++ is far from perfect there. I guess that is something to consider.

it depends if the program is for solely your own use or not. if others use it then your time is well spent commensurate with how many others use it and how often (and of course you can extend this to how much money you make off the program).

>How well does this work with meson though?
i haven't used meson much, it seems ok but cargo really really just works
unless you're doing something esoteric everything will have been handled for you
>Well you shouldn't be adding libraries for one little thing in the first place
and you wouldn't have to if the C++ standard library wasn't so lacking!
>To be honest, I never have to worry much about character encoding
i'm european so if i'm working with files and an "ä" sneaks in there everything breaks

>rust

>Programmer time is much, much more valuable than shaving off 1.44 seconds of execution time.
but MUH METRICS
can you imagine his boss's face when he told him "I optimized an internal tool used daily and now its workflow takes less than a tenth of the time?"
that's promotion material right there

If you're doing a 2D game, (and you're probably doing a 2D game), it will run at solid 60 because 2D games aren't that heavy at all.
I could easily reach 60 FPS with visual basic 6 on a pentium 200.

Now if you do it 3D, shit get weird.
Resolution will be as fucking high as you want, because that's 100% GPU.
Everything you can offload to the GPU will also run fast, so will everything you can offload to libraries.
So, the limitation will actually be on the gameplay, if you want physics and shit, it will be very hard, so will be any sort of streaming of data, which means you can do a quite pretty linear movie game.

people don't optimize because it shaves fractions of a second off the runtime, they do it because it's just better in every way
there's like a bunch of other reasons to optimize for the system that it's going to be run on probably

Then don't use the language's package manager. You're not the sole user of the language, features don't get approved because you like it or not. If the feature is there and you don't like it, don't use it. Everyone else can.

I'll have you know that my brepis loves renpy games

He's not going to, beucase as much as C/C++ proponents love telling people how much faster they're programs are, they don't actually write anything in C/C++

Attached: smug_sinestro.png (784x1484, 1.37M)

Start with C instead, or even Basic.
The most important skill you need to learn is the skill of making your brain create the routines you need.
The language thing is tiny if compared to this.

be my guest then, do you write c++ code? if so what would you say about it, if not why not or what are the benefits of your language of choice? also any noob tips on c++ are highly appreciated

THE MORAL OF THE STORY IS THAT RUST ROCKS!!!

plus he got paid to fuck around learning new shit

You will never be a women.

i work as c# developer but want to get into some c++ stuff to do lower level, more optimized stuff. have done a bit of c for microcontroller stuff but id rather use it for anything bigger than my arduino ... so im really just looking for c++ advice, not what i should learn before it

That's the only argument Jow Forums will EVER have against Rust. It's that good.

You will never be a women.

Then its fine, learn C++, have fun.
It's a bit more annoying than C# but you get speed, and a better insight on the shit the C# does under the hood.

Just use it as "C with classes" and add in the extra C++ features that make sense with your program. For an easy example, don't fucking use C style strings because they are retarded but use std::string. Don't use pthread, use std::thread. And so on. You can make C++ an unreadable mess by piling a ton of features together, but don't be that guy. You don't need to do that.

>yfw you try finding a job with Rust.

alright then, ill try to have fun
thx, ill keep that in mind

If you know how to use Rust then you know how to use C++. Syntax takes a day or two to learn at most.

Optimising anything in Rust is torture.
All SIMD documentation is for C and all CUDA tools are for C++.

Retard

>Python
Perl*

c++, tranny

>that's for characters, not strings
dilate more, brainlet

Math for this?

I seriously can't figure this out.

1.5-0.06=1.44
6x60x60=1980
1980/1.44 = 1375 -> he lost 6 hours of time but he gains 1.44 seconds every time he runs the program so he has to run it 1375 times
which is 3.767 years

I don't understand his reasoning

what

I assume he means that he runs it once per day.

1.5 - 0.06 = 1.44
6*6*60 = 21600
21600/1.44 = 15000 (he has to run it 15000 times to get his lost time back).
If we assume he runs it once per day and that there are 365.25 days in a year then:
15000/365.25 ~= 41.06 years.

Hipstergylph language

Ya but isnt Rust supported by a giant group of SJW libcucks? I'll pass.

oh shit lmao I'm never doing math in my head again

She told you to dilate you're festering neovagina

rust literally forces you at gunpoint to add at least three pro-SJW statements for every println

>running it 15,000 times to get that time back
>wasting more time instead of getting lost time back
Makes sense. Why does he even gripe about this? You lost time to save time--that's the whole point of time and money.

Thank you for explaining the math, user. I got the 15,000 part but didn't know where to go from there.