AW: Octstr functions do too many allocations
Jörg Pommnitz <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Something I suggested years ago are reference counted Octstr's. A lot of octstr_duplicate calls could easily become octstr_getref. In this case a reference count inside a octstr would go up. A reference count > 1 would make the octstr immutable and octstr_destroy would decrease the reference count and do the actual releasing only if it drops to zero. Regards Joerg -----Ursprüngliche Nachricht----- Von: Aarno Syvänen [mailto:[email protected]] Gesendet: Dienstag, 4. November 2003 11:43 An: [email protected] Betreff: Octstr functions do too many allocations Hi List, If you use mmsc and ppg performance issues are actually relevant, because use have three protocol *suites* running in the machine. (In spite of the fact that smsc and the wireless network are slow,) Worst is octstr_append, used by compilers. Octstr_append_char actually allocates just two bytes ! (Every time it is called.) When compiling, we actually can make a guess how big the output is, because we have the input document. So we can allocate everything we need at the start. Some other ideas ? Aarno