<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13367" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2022-02-04T15:53:51+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13367</id>

		<entry>
		<author><name><![CDATA[drleviathan]]></name></author>
		<updated>2022-02-04T15:53:51+00:00</updated>

		<published>2022-02-04T15:53:51+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43832#p43832</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43832#p43832"/>
		<title type="html"><![CDATA[Re: Can I reuse these Parameters when I make new DynamicsWorld?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43832#p43832"><![CDATA[
<strong class="text-strong">CollisionConfiguration</strong> = yes it is possible but depending on what you're doing you might not want to.  If you look at the declaration of the base <strong class="text-strong">btCollisionConfiguration</strong> interface you'll see the only thing its API requires is that the configuration manage some memory pools.  Meanwhile the <strong class="text-strong">btDefaultCollisionConfiguration</strong> has a hard-coded memory pool size of 4096 elements for each of its two pools.  If you were to share between multiple worlds you might hit the pool limits.  If you're running many small (e.g. few objects) worlds then maybe you could get by with just one configuration for all of them.<br><br>Meanwhile, there is some benefit to maintaining good memory "residency".  If you were to make a <strong class="text-strong">GiantCollisionConfiguration</strong> class and step each world sequentially in a single thread the worlds would scatter their allocations across the big collective pools and you might actually get better performance by keeping each pool smaller and perform less thrashing of CPU memory caches.<br><br>Here is an idea: measure how much of the pools your worlds are consuming and then implement <strong class="text-strong">TunedCollisionConfiguration</strong> which is a straight copy of <strong class="text-strong">btDefaultCollisionConfiguration</strong> but with smaller pool limits that still satisfy your expected worlds' needs.<br><br><strong class="text-strong">btDefaultCollisionConfiguration</strong> is not thread-safe so you wouldn't be able to share it between worlds running on different threads.<br><br><strong class="text-strong">Dispatcher</strong> = no, definitely not.<br><br><strong class="text-strong">OverlappingPairCache</strong> = no, no definitely not.<br><br><strong class="text-strong">Solver</strong> = yes this is possible.  The <strong class="text-strong">btSequentialImpulseConstraintSolver</strong> maintains some "pools" but they are actually unbounded <strong class="text-strong">btAlignedObjectArray&lt;T&gt;</strong> instances so you don't have to worry about hitting limits.  They expand as necessary but do not release memory: when there are piles of objects colliding all at once the pools grow to accomodate and then they keep their sizes in case there is a similar event in the future.  It is possible sharing one of these could save you some memory.  Nevertheless, the concern of thrashing the CPU memory caches could actually hinder the speed of the simulation algorithms.  You's have try both ways to measure the tradeoffs.  Not thread-safe.<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=11033">drleviathan</a> — Fri Feb 04, 2022 3:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kcjsend2]]></name></author>
		<updated>2022-02-03T05:36:21+00:00</updated>

		<published>2022-02-03T05:36:21+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43827#p43827</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43827#p43827"/>
		<title type="html"><![CDATA[Can I reuse these Parameters when I make new DynamicsWorld?]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43827#p43827"><![CDATA[
hello.<br><div class="codebox"><p>Code: </p><pre><code>mBtCollisionConfiguration = std::make_unique&lt;btDefaultCollisionConfiguration&gt;();mBtDispatcher = std::make_unique&lt;btCollisionDispatcher&gt;(mBtCollisionConfiguration.get());mBtOverlappingPairCache = std::make_unique&lt;btDbvtBroadphase&gt;();mBtSolver = std::make_unique&lt;btSequentialImpulseConstraintSolver&gt;();mBtDynamicsWorld = std::make_unique&lt;btDiscreteDynamicsWorld&gt;(mBtDispatcher.get(), mBtOverlappingPairCache.get(), mBtSolver.get(), mBtCollisionConfiguration.get());</code></pre></div>I'm trying to make few number of dynamics world, but I can't sure i can reuse these parameters. (configuration, dispatcher, solver)<br>If I have to create another dynamics world object, do I have to create a new parameters?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14021">kcjsend2</a> — Thu Feb 03, 2022 5:36 am</p><hr />
]]></content>
	</entry>
	</feed>
