You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/07/21 16:29:20 UTC
[jira] [Commented] (HAWQ-944) Numutils.c: pg_ltoa and pg_itoa
functions allocate unnecessary amount of bytes
[ https://issues.apache.org/jira/browse/HAWQ-944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15387996#comment-15387996 ]
ASF GitHub Bot commented on HAWQ-944:
-------------------------------------
GitHub user kavinderd opened a pull request:
https://github.com/apache/incubator-hawq/pull/808
HAWQ-944. Implement new pg_ltoa function as per postgres
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kavinderd/incubator-hawq HAWQ-944
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-hawq/pull/808.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #808
----
commit fb32032529eeec680d921383c056168910d99da9
Author: Kavinder Dhaliwal <ka...@gmail.com>
Date: 2016-07-20T23:14:10Z
HAWQ-944. Implement new pg_ltoa function as per postgres
----
> Numutils.c: pg_ltoa and pg_itoa functions allocate unnecessary amount of bytes
> ------------------------------------------------------------------------------
>
> Key: HAWQ-944
> URL: https://issues.apache.org/jira/browse/HAWQ-944
> Project: Apache HAWQ
> Issue Type: Improvement
> Components: Core
> Reporter: Kavinder Dhaliwal
> Assignee: Kavinder Dhaliwal
> Priority: Minor
>
> The current implementations of {{pg_ltoa}} and {{pg_itoa}} allocate a 33 byte char array and set the input pointer to that array. This is far too many bytes than needed to translate an int16 or int32 to a string
> int32 -> 10 bytes maximum + 1 sign bit + '\0' = 12 bytes
> int16 -> 5 bytes maximum + 1 sign bit + '\0' = 7 bytes
> When HAWQ/Greenplum forked from Postgres the two functions simply delegated to {{sprintf}} so an optimization was introduced that involved the 33 byte solution. Postgres itself implemented these functions in commit https://github.com/postgres/postgres/commit/4fc115b2e981f8c63165ca86a23215380a3fda66 that require a 12 byte maximum char pointer.
> This is a minor improvement that can be made to the HAWQ codebase and it's relatively little effort to do so.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)