new iconv-transcoder algorithm
------------------------------
Key: XERCESC-1428
URL: http://issues.apache.org/jira/browse/XERCESC-1428
Project: Xerces-C++
Type: Improvement
Components: Utilities
Environment: linux
Reporter: Axel Weiss
Priority: Minor
Attachments: transcoder-179120.diff
James Berry wrote:
> What if you make this initial buffer a static buffer? And allocate
> the exact size needed at the end?
> That keeps the memory cost constant, at the expense of a guaranteed
> extra string copy.
>
> For cases where you exceed the static buffer size, continue to do
> your size-doubling on overflow; for the cases where you exceed the
> static buffer size, you'll continue to use excess memory.
>
> I think this tradeoff would be worth it...
Ok, it now starts with a local buffer on the stack and creates a copy with the
exact size needed, if this buffer was not exceeded. Otherwise, an always
doubling buffer enlargement is performed, resulting in returning an excess
buffer for the result.
The patch is against 3.0-unstable-179120.
Axel
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]