Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue #3

Open
tbabm93 opened this issue Oct 28, 2021 · 1 comment
Open

Performance issue #3

tbabm93 opened this issue Oct 28, 2021 · 1 comment

Comments

@tbabm93
Copy link

tbabm93 commented Oct 28, 2021

Hi, I tested the memory pool, and I found that the performance of this memory pool is not good as allocating memory from heap, so the code is only for beginner to learn, right?

Allocate memory from memory pool: 0.304s
Allocate memory form heap: 0.0608

for(int i = 0; i < 200000; ++i) {
v = new TestMemoryPool();
}

@12UE
Copy link

12UE commented Sep 11, 2023

template
float Test_Speed(int Times, _PRE bin) {
DWORD time1 = clock();
float count = 0;
while (count < Times) {
bin();
count++;
}
float elpstime = clock() - (float)time1;
auto total = count / (elpstime / 1000.0f);
printf("Speed: %0.0f/s\r\n", total);
return total;
}
I use this code to test runnning speed
but slower than new why cause that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants