I need a decent alternative to c++ [closed]

I’ve learned php and c++, i will list the things i liked and didn’t liked on each of them, how i decided to learn them in the first place and why i feel the need to learn a decent alternative to c++, i’m not a professional programmer and only do projects for myself.

PHP – Decided to learn because i wanted to build a dynamic website, that i did and turned out very good, i even coded a ‘not so basic’ search engine for it that would display the results ‘google style’ and really fast, pretty cool stuff.

PROS – Pretty consistent syntax for all stuff (minor caveats), great functionality, a joy for me to code in it (it seems to ‘know’ what i want it to do and just does it)

CONS – Painfully slow for number crunching (which takes me to c++ that i only learned because i wanted to do some number crunching and it had to be screaming fast)

C++ – Learned because number crunching was so slow in php and manipulating large amounts of data was very difficult, i thought, it’s popular programming language and all, and tests show that it’s fast, the basic stuff resemble php so it shouldn’t be hard to pick up

PROS – It can be used to virtually anything, very very fast

CONS – Although fun to code at the start, if i need to do something out of the ordinary, memory allocation routines, pointer stuff, stack sizes etc… will get me tired really quick, syntax is a bit inconsistent some times (more caveats)

I guess that from what i wrote you guys will understand what i’m looking for, there are thousands of languages out there, it’s likely that one of them will suit my needs, i’ve been seeing stuff today and a friend of mine that is a professional programmer tried OCaml and Fortran and said that both are fast for numerical stuff, i’ve been inclined to test Fortran, but i need some more input because i want to have some other good ‘candidates’ to choose from, for example the python syntax seemed great to me, but then i found out from some tests that it was a lot slower than c++ and i simply don’t want to twiddle my thumbs all day.

16

Sounds like PHP was too high of a level for you and C++ was too low. I’m a C++ programmer myself and I do agree that sometimes signal-to-noise ratio, especially for a new person, can be quite low. It still has its place in many areas, but I would not use it for general programming.

The languages I would recommend would be C#, Python or Java. Of those Java is at the end of the list because it seems like it’s no longer the hot item in the industry and if you are going to learn something, might as well pick up a skill other people are looking for.

Both C# and Java are similar to syntax of C++, but they are less flexible which is a good and a bad thing. For you, its mostly a good thing since the flexibility is what introduces complexity. Both languages will not allow you to pave over memory and will worry about allocations for you so you can focus on the actual logic.

Python is quite different and I’m not entirely sure how it compares in speed since I believe it is still interpreted whereas C# just-in-time compiles to machine code. But it is still a fun language.

3

If PHP is too slow for you, you can always write the performance sensitive parts in C++ and then call those C++ functions from PHP (see this stackoverflow question).

For relatively fast servers, Java and C# are also good options. They may not always be as fast as C++, but for most purposes they are “fast enough”.

For some workloads, you may also hear that node.js is the fastest, but not in your case. Node.js specializes in I/O-bound operations, and you seem to be stuck in CPU-bound operations, so node.js would be “pretty fast, but not mind-blowingly so”.

For C++, there are a number of things you could do to improve the situation. I suspect you might be doing something wrong if stack sizes are such a huge problem for you.

  1. Pointers might be easier to handle if you try smart pointers.
  2. Avoid manually allocating stuff if you can. If you want to allocate memory for a bunch of stuff, just use a vector and let C++’s STL do the complex stuff for you.

Finally, you might try a PHP compiler to accelerate PHP without needing to switch languages. See Phalanger, phc and HipHop.

Try many different technologies and see what works for you.

If performance is really a major issue, and your calculations can be split into many smaller independent steps, then languages like OpenCL might help.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật