+ 1

Should I learn C++?

I'm working on a (larger-scale) project. The program itself works without a frontend and runs automatically just via cronjobs, but I also have a frontend for developing, monitoring, debugging. It's all written in pure PHP. The main task of it is to send (many) requests to another web page and check the answer (but it's not kinda DDOS). My program works great now, runs on a webhosting space due to better performance and speed (yes, it's even better than on vServer, don't ask me why). As I don't need 3rd party programs, it's alright. I heard that C++ would be much faster. I see no reason why to change the whole program, but I could change the one file which is doing the "real work" to increase the speed. It would be very hard to change every single file, it would also cause problems with the frontend. But is it worth it just to learn C++ for this task? And is it even worth to rewrite this one file?

24th Oct 2021, 11:31 PM
Nexo
Nexo - avatar
4 Answers
0
It sounds like the bottle neck of your program is making many synchronous http requests. I highly doubt you'll notice much difference by simply using C++ for the same task. I'm not familiar with the PHP implementation, but I think you may need to simply make all of those requests async/use coroutines so you don't have to wait for each network call to finish before starting another.
25th Oct 2021, 10:02 AM
bornToCode()
bornToCode() - avatar
25th Oct 2021, 10:14 AM
bornToCode()
bornToCode() - avatar
0
I'm already using curl_multi
26th Oct 2021, 7:16 PM
Nexo
Nexo - avatar
0
I see, yeah I'm not very familiar with async tasks in php. Node.js, Kotlin and Java seem more straight forward to me for that sort of thing. Well I still think that since the work just involves making requests to another web page, C++ wouldn't do much more for you. It depends on the response time of the other page mostly if I'm understanding your question right.
26th Oct 2021, 10:39 PM
bornToCode()
bornToCode() - avatar