Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5cb0e33

Browse files
committed
Speed up operations on numeric, mostly by avoiding palloc() overhead.
In many functions, a NumericVar was initialized from an input Numeric, to bepassed as input to a calculation function. When the NumericVar is notmodified, the digits array of the NumericVar can point directly to the digitsarray in the original Numeric, and we can avoid a palloc() and memcpy(). Addinit_var_from_num() function to initialize a var like that.Remove dscale argument from get_str_from_var(), as all the callers justpassed the dscale of the variable. That means that the rounding it used todo was not actually necessary, and get_str_from_var() no longer scribbles onits input. That makes it safer in general, and allows us to use the newinit_var_from_num() function in e.g numeric_out().Also modified numericvar_to_int8() to no scribble on its input either. Itcreates a temporary copy to avoid that. To compensate, the callers no longerneed to create a temporary copy, so the net # of pallocs is the same, but thisis nicer.In the passing, use a constant for the number 10 in get_str_from_var_sci(),when calculating 10^exponent. Saves a palloc() and some cycles to convertinteger 10 to numeric.Original patch by Kyotaro HORIGUCHI, with further changes by me. Reviewedby Pavel Stehule.
1 parentb55743a commit5cb0e33

File tree

1 file changed

+104
-155
lines changed

1 file changed

+104
-155
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp