You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Bad Idea (TM) "objects" */intmain() {
printf("string block!\n");
for (inti=0; i<LOOPS; i++) {
string_t*test=string("test");
test->reverse();
test->free();
}
}
The latter, which uses the string "object" below, is about 25 times slower than the former, which is to be expected considering all of the extra memory allocations.
Is there a way to reduce the number of memory allocations by implementing a version of Block_copy designed for the circus act you see below? That is, could the scope that each block closes over be copied just once instead of for each "method"?
First off, what I'm doing is definitely a Bad Idea (TM), but let's leave that aside for the moment! 😄
I've been having fun combining blocks and structs to create "objects". It works just fine... except for performance.
From https://github.com/williamcotton/express-c/tree/master/research/blocks
The latter, which uses the string "object" below, is about 25 times slower than the former, which is to be expected considering all of the extra memory allocations.
Is there a way to reduce the number of memory allocations by implementing a version of Block_copy designed for the circus act you see below? That is, could the scope that each block closes over be copied just once instead of for each "method"?
From https://github.com/williamcotton/express-c/blob/master/src/string/string.c#L202
The text was updated successfully, but these errors were encountered: