Skip to content

find_best_packing is embarassingly parallel #16

@geneotech

Description

@geneotech

One could at the very least perform these using std::async:

		auto make_order = [&f, &orders_ref](auto& predicate) {
			std::sort(orders_ref[f].begin(), orders_ref[f].end(), predicate);
			++f;
		};

		make_order(comparator);
		(make_order(comparators), ...);

But they could be combined with a direct call to best_packing_for_ordering instead of calling find_best_packing_impl. The workers would of course need to declare their own:

		empty_spaces_type root = rect_wh();
		root.flipping_mode = input.flipping_mode;

And then after all workers complete, re-insert the best order and handle successful/unsuccessful insertions.
However, it would be good to only do this under #ifndef RECTPACK2D_SINGLETHREADED just in case.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions