Commit b14b1eb
committed
Teach convert() and friends to avoid copying when possible.
Presently, pg_convert() allocates a new bytea and copies the result
regardless of whether any conversion actually happened. This
commit adjusts this function to return the source pointer as-is if
no conversion occurred. This optimization isn't expected to make a
tremendous difference, but it still seems worthwhile to avoid
unnecessary memory allocations.
Author: Yurii Rashkovskii
Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/CA%2BRLCQyknBPSWXRBQGOi6aYEcdQ9RpH9Kch4GjoeY8dQ3D%2Bvhw%40mail.gmail.com1 parent e7c6efe commit b14b1eb
1 file changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
588 | | - | |
589 | | - | |
590 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
| 596 | + | |
595 | 597 | | |
596 | 598 | | |
597 | 599 | | |
598 | | - | |
599 | | - | |
600 | | - | |
| 600 | + | |
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| |||
0 commit comments