find_best_packing: store orders side-by-side in a single vector#15
find_best_packing: store orders side-by-side in a single vector#15geneotech merged 54 commits intoTeamHypersomnia:masterfrom
Conversation
|
Hey, cool idea with reducing the number of allocations! It does seem like an overkill to bump the C++ requirement for just Sorry for the late response - I was overloaded with work. |
|
Yeah, that's a good idea. Working on that right now—just gotta read through a few pages' worth of template errors :D |
|
Should be all right now. |
|
Not sure whether you're notified of new commits, so I'll leave this comment here just in case to say that I've got another proposed fix for the issues you've mentioned. No rush though! 😎 |
The segmentation fault is still unresolved - as explained earlier, the problem is with this line: Don't get me wrong, but... do you perhaps run your code before announcing it as ready? 😅 If there is a zero-sized rectangle in |
Sorry, accidentally skipped over this earlier. And, well, you're right, I'm often too trigger happy when coding my own projects and don't have much experience with PRs. I'll write a few tests for myself and be a bit more diligent. |
|
I went ahead and looked for any other whitespace anomalies—there should be none left. |
This reverts commit c96e235.
|
I'll take a look tomorrow, take your time. Thank you! |
|
Okay, now the PR is a pleasure to look at. I made some finishing adjutments. |
|
LGTM 🫡 |
|
Yes, I think your job here is done, I'll give it a test run in Hypersomnia just to make sure and merge in the evening. Thank you for your determination. Hopefully you weren't discouraged by my strictness, as this library has been basically picked up by a few multi-billion dollar companies, hence becoming somewhat of my personal showpiece, so I wish to hold it to the highest standard (though admittedly, there's a bit of tidying up of my own code that I need to do). It is gladdening to see the younger generation accept feedback so readily. All the best! |
|
I totally understand why you'd want to keep this project "sanitized", especially given the reasons you outlined. Not that my initial YOLO mindset contributed in any way, but you live and you learn, right? Anyways, I'd like to thank you as well for both your non-consensual mentorship during the whole review process, and the project itself; I stumbled upon it when I was burnt out with my own 2D game project, and it let me focus on other areas of development. Funnily enough, the idea for this optimization came about when rewriting the project in Rust as part of a larger rewrite I'm doing as a learning exercise, since that language has first-class support for spans (or slices, I think they're called). |
This is a simple edit to use a single
std::vectorfor storing all orders right next to each other (which works well because all orders have the same known size), and manipulate individual orders in various algorithm functions withstd::span. Hopefully, this'll both reduce heap allocations and benefit cache usage. The example provided with the library compiles and produces the same results as the currentmasterbranch.The only drawback is that the usage of
std::spanimposes a C++20 requirement on library consumers—which I fully understand if that's a no-go.