Mike Lambert wrote: > Just to complete this thread, I have committed the current version of my > COW code, as I promised earlier this week.
Some final 5000 life results from my system, and a few improvements I believe are still possible: Before COW: 172 seconds After COW: 121 seconds A 30% improvement in performance is not too bad, I suppose. Well done Mike! CVS/COW with stack pointer alignment = four: 93 seconds Above plus pre-mask for PMC/Buffer alignment = four: 90 seconds The first of these improvements is achieved by determining the alignment with which pointers are actually placed on the stack, versus PARROT_PTR_ALIGNMENT, which is the minimum alignment permitted by the underlying system. On an Intel x86 platform running linux, I have been unable to persuade any pointer to live on the stack other than on a four-byte alignment, except by placing it in a struct, and telling the compiler to pack structs. A simple C program is included below which illustrates this point. The second improvement achieves very little incremental improvement (possibly more would be achieved if the first change was not in place). It takes advantage of the current alignment (again on my specific platform) of both PMC and Buffer/String structures on 4-byte size boundaries; this means that the low-order 2 bits of any valid pointer will always be zero, which can be quickly checked before the slower checks are performed. > If you don't mind, please feel free to continue your work on parrot-grey. The problem arises with trying to do new experimental development, which still keeping sufficiently in sync with cvs parrot that I can do a 'cvs update' from time to time without getting dozens of conflicts. A case in point is the new 'strstart' field - grey doesn't need it, but to leave it out would create a large number of differences between the two versions, with code having to be changed every time somebody writes a new reference to it - therefore if I do continue with grey, I will just probably just leave strstart in, and ignore the memory overhead. The next item on the list for grey was paged memory allocation - this may be usable to some extent without the buffer linked lists; so I will probably give that a spin anyway. -- Peter Gibbs EmKel Systems main() { void * a; void * b; char c; void * d; struct { void * a; void * b; char c; void * d; } x; if (a > b) { printf("Stack grows downwards\n"); printf("Pointer alignment on stack = %ld\n", ((int)&b - (int)&d) - ((int)&a - (int)&b)); } else { printf("Stack grows upwards\n"); printf("Pointer alignment on stack = %ld\n", ((int)&d - (int)&b) - ((int)&b - (int)&a)); } printf("Pointer alignment in struct = %ld\n", ((int)&x.d - (int)&x.b) - ((int)&x.b - (int)&x.a)); }