mirror of https://github.com/axmolengine/axmol.git
Merge branch 'alloc_perf_test' of https://github.com/ricardoquesada/cocos2d-x into alloc_perf_test
This commit is contained in:
commit
d723c4ef3f
|
@ -36,6 +36,7 @@ static std::function<PerformceAllocScene*()> createFunctions[] =
|
||||||
{
|
{
|
||||||
CL(NodeCreateTest),
|
CL(NodeCreateTest),
|
||||||
CL(NodeDeallocTest),
|
CL(NodeDeallocTest),
|
||||||
|
CL(SpriteCreateEmptyTest),
|
||||||
CL(SpriteCreateTest),
|
CL(SpriteCreateTest),
|
||||||
CL(SpriteDeallocTest),
|
CL(SpriteDeallocTest),
|
||||||
};
|
};
|
||||||
|
@ -318,6 +319,56 @@ const char* NodeDeallocTest::testName()
|
||||||
return "Node::~Node()";
|
return "Node::~Node()";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SpriteCreateEmptyTest
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
void SpriteCreateEmptyTest::updateQuantityOfNodes()
|
||||||
|
{
|
||||||
|
currentQuantityOfNodes = quantityOfNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCreateEmptyTest::initWithQuantityOfNodes(unsigned int nNodes)
|
||||||
|
{
|
||||||
|
PerformceAllocScene::initWithQuantityOfNodes(nNodes);
|
||||||
|
|
||||||
|
printf("Size of Node: %lu\n", sizeof(Sprite));
|
||||||
|
|
||||||
|
scheduleUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCreateEmptyTest::update(float dt)
|
||||||
|
{
|
||||||
|
// iterate using fast enumeration protocol
|
||||||
|
|
||||||
|
Sprite **sprites = new Sprite*[quantityOfNodes];
|
||||||
|
|
||||||
|
Sprite::create("Images/grossini.png");
|
||||||
|
|
||||||
|
CC_PROFILER_START(this->profilerName());
|
||||||
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
|
sprites[i] = Sprite::create();
|
||||||
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
|
delete [] sprites;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string SpriteCreateEmptyTest::title()
|
||||||
|
{
|
||||||
|
return "Create Empty Sprite";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string SpriteCreateEmptyTest::subtitle()
|
||||||
|
{
|
||||||
|
return "Create Empty Sprite Perf test. See console";
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* SpriteCreateEmptyTest::testName()
|
||||||
|
{
|
||||||
|
return "Sprite::create(void)";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SpriteCreateTest
|
// SpriteCreateTest
|
||||||
|
@ -343,9 +394,11 @@ void SpriteCreateTest::update(float dt)
|
||||||
|
|
||||||
Sprite **sprites = new Sprite*[quantityOfNodes];
|
Sprite **sprites = new Sprite*[quantityOfNodes];
|
||||||
|
|
||||||
|
Sprite::create("Images/grossini.png");
|
||||||
|
|
||||||
CC_PROFILER_START(this->profilerName());
|
CC_PROFILER_START(this->profilerName());
|
||||||
for( int i=0; i<quantityOfNodes; ++i)
|
for( int i=0; i<quantityOfNodes; ++i)
|
||||||
sprites[i] = Sprite::create();
|
sprites[i] = Sprite::create("Images/grossini.png");
|
||||||
CC_PROFILER_STOP(this->profilerName());
|
CC_PROFILER_STOP(this->profilerName());
|
||||||
|
|
||||||
delete [] sprites;
|
delete [] sprites;
|
||||||
|
@ -353,17 +406,17 @@ void SpriteCreateTest::update(float dt)
|
||||||
|
|
||||||
std::string SpriteCreateTest::title()
|
std::string SpriteCreateTest::title()
|
||||||
{
|
{
|
||||||
return "Sprite Create Perf test.";
|
return "Create Sprite.";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SpriteCreateTest::subtitle()
|
std::string SpriteCreateTest::subtitle()
|
||||||
{
|
{
|
||||||
return "Sprite Create Perf test. See console";
|
return "Create Empty Sprite. See console";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* SpriteCreateTest::testName()
|
const char* SpriteCreateTest::testName()
|
||||||
{
|
{
|
||||||
return "Sprite::create()";
|
return "Sprite::create(\"image\")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -70,6 +70,18 @@ public:
|
||||||
std::string subtitle();
|
std::string subtitle();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SpriteCreateEmptyTest : public PerformceAllocScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void updateQuantityOfNodes();
|
||||||
|
virtual void initWithQuantityOfNodes(unsigned int nNodes);
|
||||||
|
virtual void update(float dt);
|
||||||
|
virtual const char* testName();
|
||||||
|
|
||||||
|
std::string title();
|
||||||
|
std::string subtitle();
|
||||||
|
};
|
||||||
|
|
||||||
class SpriteCreateTest : public PerformceAllocScene
|
class SpriteCreateTest : public PerformceAllocScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue