[ https://issues.apache.org/jira/browse/TS-2151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Leif Hedstrom updated TS-2151: ------------------------------ Fix Version/s: (was: 6.0.0) 5.0.0 > Do we really need HttpSM::_instantiate_func() now? > -------------------------------------------------- > > Key: TS-2151 > URL: https://issues.apache.org/jira/browse/TS-2151 > Project: Traffic Server > Issue Type: Improvement > Components: Core > Reporter: Leif Hedstrom > Assignee: Leif Hedstrom > Fix For: 5.0.0 > > > The HttpSM implements the instantiate_func() which means the Sparse Class > allocator ends up trying to "optimize" the memcpy(). We should benchmark > this, and see if is actually a performance improvement still. Simplifying > this code with just a mempcy() (i.e. use normal class allocator behavior) > would make it safer and less confusing. > {code} > void > HttpSM::_instantiate_func(HttpSM * prototype, HttpSM * new_instance) > { > int history_len = sizeof(prototype->history); > int total_len = sizeof(HttpSM); > int pre_history_len = (char *) (&(prototype->history)) - (char *) prototype; > int post_history_len = total_len - history_len - pre_history_len; > int post_offset = pre_history_len + history_len; > #ifndef SIMPLE_MEMCPY_INIT > int j; > memset(((char *) new_instance), 0, pre_history_len); > memset(((char *) new_instance) + post_offset, 0, post_history_len); > uint32_t *pd = (uint32_t *) new_instance; > for (j = 0; j < scat_count; j++) { > pd[to[j]] = val[j]; > } > ink_assert((memcmp((char *) new_instance, (char *) prototype, > pre_history_len) == 0) && > (memcmp(((char *) new_instance) + post_offset, ((char *) > prototype) + post_offset, post_history_len) == 0)); > #else > // memcpy(new_instance, prototype, total_len); > memcpy(new_instance, prototype, pre_history_len); > memcpy(((char *) new_instance) + post_offset, ((char *) prototype) + > post_offset, post_history_len); > #endif > } > {code} -- This message was sent by Atlassian JIRA (v6.1#6144)