On MSVC, std::deque degenerates to a list of pointers, which defeats
its purpose of reducing allocator load and memory fragmentation. https://github.com/microsoft/STL/issues/147#issuecomment-1090148740 Slic3r::deque<> compiles to boost::container::deque<> on Windows, to std::deque<> on other systems. SeamPlacer newly uses Slic3r::deque<>.
This commit is contained in:
parent
adb467286f
commit
8c2e6aba79
@ -6,6 +6,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
|
#include "libslic3r/libslic3r.h"
|
||||||
#include "libslic3r/ExtrusionEntity.hpp"
|
#include "libslic3r/ExtrusionEntity.hpp"
|
||||||
#include "libslic3r/Polygon.hpp"
|
#include "libslic3r/Polygon.hpp"
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
@ -93,7 +94,7 @@ struct PrintObjectSeamData
|
|||||||
|
|
||||||
struct LayerSeams
|
struct LayerSeams
|
||||||
{
|
{
|
||||||
std::deque<SeamPlacerImpl::Perimeter> perimeters;
|
Slic3r::deque<SeamPlacerImpl::Perimeter> perimeters;
|
||||||
std::vector<SeamPlacerImpl::SeamCandidate> points;
|
std::vector<SeamPlacerImpl::SeamCandidate> points;
|
||||||
std::unique_ptr<SeamCandidatesTree> points_tree;
|
std::unique_ptr<SeamCandidatesTree> points_tree;
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,13 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// On MSVC, std::deque degenerates to a list of pointers, which defeats its purpose of reducing allocator load and memory fragmentation.
|
||||||
|
// https://github.com/microsoft/STL/issues/147#issuecomment-1090148740
|
||||||
|
// Thus it is recommended to use boost::container::deque instead.
|
||||||
|
#include <boost/container/deque.hpp>
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
#include "Technologies.hpp"
|
#include "Technologies.hpp"
|
||||||
#include "Semver.hpp"
|
#include "Semver.hpp"
|
||||||
|
|
||||||
@ -73,6 +80,16 @@ namespace Slic3r {
|
|||||||
|
|
||||||
extern Semver SEMVER;
|
extern Semver SEMVER;
|
||||||
|
|
||||||
|
// On MSVC, std::deque degenerates to a list of pointers, which defeats its purpose of reducing allocator load and memory fragmentation.
|
||||||
|
template<class T, class Allocator = std::allocator<T>>
|
||||||
|
using deque =
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Use boost implementation, which allocates blocks of 512 bytes instead of blocks of 8 bytes.
|
||||||
|
boost::container::deque<T, Allocator>;
|
||||||
|
#else // _WIN32
|
||||||
|
std::deque<T, Allocator>;
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
template<typename T, typename Q>
|
template<typename T, typename Q>
|
||||||
inline T unscale(Q v) { return T(v) * T(SCALING_FACTOR); }
|
inline T unscale(Q v) { return T(v) * T(SCALING_FACTOR); }
|
||||||
|
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/config/warning_disable.hpp>
|
#include <boost/config/warning_disable.hpp>
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
#ifdef _WIN32
|
||||||
|
// On MSVC, std::deque degenerates to a list of pointers, which defeats its purpose of reducing allocator load and memory fragmentation.
|
||||||
|
// https://github.com/microsoft/STL/issues/147#issuecomment-1090148740
|
||||||
|
// Thus it is recommended to use boost::container::deque instead.
|
||||||
|
#include <boost/container/deque.hpp>
|
||||||
|
#endif // _WIN32
|
||||||
#include <boost/date_time/local_time/local_time.hpp>
|
#include <boost/date_time/local_time/local_time.hpp>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
Loading…
Reference in New Issue
Block a user