Re: Inlining of couple of functions in pl_exec.c improves performance

From: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Inlining of couple of functions in pl_exec.c improves performance
Date: 2020-06-01 05:53:04
Message-ID: CAJ3gD9eMZwvkKiBzMhGi51OY8q1WwcU4YdWQ4X0bxN7Ow=iMzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 31 May 2020 at 08:04, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> This stuff is interesting. Do you have some perf profiles to share?
> I am wondering what's the effect of the inlining with your test
> cases.

Below are the perf numbers for asignmany.sql :

HEAD :

+ 16.88% postgres postgres [.] CachedPlanIsSimplyValid
+ 16.64% postgres plpgsql.so [.] exec_stmt
+ 15.56% postgres plpgsql.so [.] exec_eval_expr
+ 13.58% postgres plpgsql.so [.] exec_assign_value
+ 7.49% postgres plpgsql.so [.] exec_cast_value
+ 7.17% postgres plpgsql.so [.] exec_assign_expr
+ 5.39% postgres postgres [.] MemoryContextReset
+ 3.91% postgres postgres [.] ExecJustConst
+ 3.33% postgres postgres [.] recomputeNamespacePath
+ 2.88% postgres postgres [.] OverrideSearchPathMatchesCurrent
+ 2.18% postgres plpgsql.so [.] exec_eval_cleanup.isra.17
+ 2.15% postgres plpgsql.so [.] exec_stmts
+ 1.32% postgres plpgsql.so [.] MemoryContextReset(at)plt
+ 0.57% postgres plpgsql.so [.] CachedPlanIsSimplyValid(at)plt
+ 0.57% postgres postgres [.] GetUserId
0.30% postgres plpgsql.so [.] assign_simple_var.isra.13
0.05% postgres [kernel.kallsyms] [k] unmap_page_range

Patched :

+ 18.22% postgres postgres [.] CachedPlanIsSimplyValid
+ 17.25% postgres plpgsql.so [.] exec_eval_expr
+ 16.31% postgres plpgsql.so [.] exec_stmts
+ 15.00% postgres plpgsql.so [.] exec_assign_value
+ 7.56% postgres plpgsql.so [.] exec_assign_expr
+ 5.64% postgres postgres [.] MemoryContextReset
+ 5.16% postgres postgres [.] ExecJustConst
+ 4.86% postgres postgres [.] recomputeNamespacePath
+ 4.54% postgres postgres [.] OverrideSearchPathMatchesCurrent
+ 2.33% postgres plpgsql.so [.] exec_eval_cleanup.isra.17
+ 1.26% postgres plpgsql.so [.] MemoryContextReset(at)plt
+ 0.81% postgres postgres [.] GetUserId
+ 0.71% postgres plpgsql.so [.] CachedPlanIsSimplyValid(at)plt
0.26% postgres plpgsql.so [.] assign_simple_var.isra.13
0.03% postgres [kernel.kallsyms] [k] unmap_page_range
0.02% postgres [kernel.kallsyms] [k] mark_page_accessed

Notice the reduction in percentages :
HEAD : exec_stmts + exec_stmt = 18.79
Patched : exec_stmts = 16.31

HEAD : exec_assign_value + exec_cast_value : 21.07
Patched : exec_assign_value = 15.00

As expected, reduction of percentage in these two functions caused
other functions like CachedPlanIsSimplyValid() and exec_eval_expr() to
show rise in their percentages.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-06-01 05:55:27 Re: segmentation fault using currtid and partitioned tables
Previous Message Pavel Stehule 2020-06-01 03:35:59 Re: Compatible defaults for LEAD/LAG