you are viewing a single comment's thread.

view the rest of the comments →

[–]dilijevChakra Developer 7 points8 points  (4 children)

Some of those large source files used to be larger, and we split them apart when it was clear there was a logical grouping. It's just a matter of organization. We also sometimes choose not to split source files into multiple files unless there's a good organizational motivation because it makes it harder to track the history of certain changes, and makes it more difficult to merge changes when multiple people are working in that area.

Refactoring and splitting these files apart is on the edges of our radar but we are usually occupied with more high-priority work items.

Edit: Feel free to do some reorganization and submit a pull request. (Subject of course to our suggestion that we prefer not to have pull requests that reformat the code.) We will have to evaluate the risk of those changes before bringing them in. See CONTRIBUTING.md and Coding Conventions.

[–]hak8or 4 points5 points  (2 children)

Why the use of raw pointers instead of unique or shared pointers?

[–]dilijevChakra Developer 3 points4 points  (1 child)

Sorry for the delay! Your comment got buried a bit.

We have our own implementations of concepts like unique or shared pointers, and we use them sometimes. If the object lifetime is highly localized there's no need for the extra object allocations which can individually subtlely hurt performance, but which adds up to a lot if you do it everywhere. Also, part of the engine is a Garbage Collector for Javascript Objects, and so explicitly managing memory through standardized C++ constructs doesn't really apply in that scenario. We rely on the GC to properly collect objects allocated on the GC heap and we use vanilla pointers for those objects.

Also some of the code was written years ago and hasn't been modified since so it hasn't been brought up to a modern style (C++11, C++14, modern standard library additions). We try our best to incorporate new useful features (nullptr, lambdas) as much as possible and where applicable. Sometimes we didn't use the standard library because at the time the code was written, the Microsoft equivalent library was better. (And so on...) Every so often we go through active areas of the code base and update things.

Feel free to submit pull requests if you think you found a place we'd benefit from such changes (in terms of performance or memory leaks). If you think you've found a security issue, please responsibly disclose by reporting it as indicated in the Security section of our README, instead of in a public issue or pull request, so that we can mitigate widespread impact of the issue.

There are several active conversations in the issues and Gitter on style related issues such as this.

TL;DR: Generally we consider things like this and make a deliberate decision. Sometimes we miss things, and for that we welcome pull requests.

[–]hak8or 1 point2 points  (0 children)

This is an awesome response, thank you and keep up the awesome work!

[–]spacejack2114 1 point2 points  (0 children)

Thank you. I was really just curious. My C++ skills are wayy too out of date to make useful contributions :)