2 @message |
Performance problem
assert
- Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
+ Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.55 -- greater than threshold = 0.55
+ Check result of 21 measures:
+ 0 : 0.54
+ 1 : 0.51
+ 2 : 0.55
+ 3 : 0.55
+ 4 : 0.50
+ 5 : 0.52
+ 6 : 0.55
+ 7 : 0.48
+ 8 : 0.59
+ 9 : 0.53
+ 10 : 0.51
+ 11 : 0.55
+ 12 : 0.53
+ 13 : 0.61
+ 14 : 0.55
+ 15 : 0.73
+ 16 : 0.68
+ 17 : 0.55
+ 18 : 0.55
+ 19 : 0.52
+ 20 : 0.59
Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
LOG DETAILS:
2025-06-30 17:18:31.916
2025-06-30 17:18:31.926 act = <firebird.qa.plugin.Action object at [hex]>
2025-06-30 17:18:31.934 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-06-30 17:18:31.941
2025-06-30 17:18:31.947 @pytest.mark.version('>=3.0')
2025-06-30 17:18:31.951 def test_1(act: Action, capsys):
2025-06-30 17:18:31.957
2025-06-30 17:18:31.963 act.db.set_async_write() # just to be sure, although this is by default
2025-06-30 17:18:31.969
2025-06-30 17:18:31.975 expected_stdout = f"""
2025-06-30 17:18:31.981 Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} packaged PSQL objects: acceptable
2025-06-30 17:18:31.986 Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} standalone PSQL objects: acceptable
2025-06-30 17:18:31.991 """
2025-06-30 17:18:32.003
2025-06-30 17:18:32.013 func_headers_ddl = ''.join( [ '\n function fn_%d returns int;' % i for i in range(N_LIMIT) ] )
2025-06-30 17:18:32.020 func_bodies_ddl = ''.join( [ '\n function fn_%d returns int as begin return %d; end' % (i,i) for i in range(N_LIMIT) ] )
2025-06-30 17:18:32.026
2025-06-30 17:18:32.031 pkg_header_ddl = '\n'.join( ('create or alter package huge as\nbegin', func_headers_ddl, 'end') )
2025-06-30 17:18:32.040 pkg_body_ddl = '\n'.join( ('recreate package body huge as\nbegin', func_bodies_ddl, 'end') )
2025-06-30 17:18:32.049
2025-06-30 17:18:32.057 sp_time = {}
2025-06-30 17:18:32.063 with act.db.connect() as con:
2025-06-30 17:18:32.069
2025-06-30 17:18:32.074 with con.cursor() as cur:
2025-06-30 17:18:32.080 cur.execute('select mon$server_pid as p from mon$attachments where mon$attachment_id = current_connection')
2025-06-30 17:18:32.085 fb_pid = int(cur.fetchone()[0])
2025-06-30 17:18:32.091
2025-06-30 17:18:32.096 for i in range(0, N_MEASURES):
2025-06-30 17:18:32.102 for ftype in ('packaged', 'standalone'):
2025-06-30 17:18:32.109
2025-06-30 17:18:32.115 fb_info_a = psutil.Process(fb_pid).cpu_times()
2025-06-30 17:18:32.122 if ftype == 'packaged':
2025-06-30 17:18:32.128 con.execute_immediate(pkg_header_ddl)
2025-06-30 17:18:32.135 con.execute_immediate(pkg_body_ddl)
2025-06-30 17:18:32.141 else:
2025-06-30 17:18:32.146 for k in range(0,N_LIMIT):
2025-06-30 17:18:32.151 con.execute_immediate( 'create or alter function sf_%d returns int as begin return %d; end' % (k,k) )
2025-06-30 17:18:32.156
2025-06-30 17:18:32.161 fb_info_b = psutil.Process(fb_pid).cpu_times()
2025-06-30 17:18:32.167 con.commit()
2025-06-30 17:18:32.174 fb_info_c = psutil.Process(fb_pid).cpu_times()
2025-06-30 17:18:32.186
2025-06-30 17:18:32.194 cpu_time_for_compile = max(fb_info_b.user - fb_info_a.user, 0.000001)
2025-06-30 17:18:32.203 cpu_time_for_commit = fb_info_c.user - fb_info_b.user
2025-06-30 17:18:32.212
2025-06-30 17:18:32.219 sp_time[ ftype, i ] = cpu_time_for_commit / cpu_time_for_compile
2025-06-30 17:18:32.225
2025-06-30 17:18:32.230 commit_2_compile_ratio_for_package = [round(v,2) for k,v in sp_time.items() if k[0] == 'packaged']
2025-06-30 17:18:32.236 commit_2_compile_ratio_for_standal = [round(v,2) for k,v in sp_time.items() if k[0] == 'standalone']
2025-06-30 17:18:32.242
2025-06-30 17:18:32.249 actual_time_ratios_commit2compile = { 'packaged' : median(commit_2_compile_ratio_for_package), 'standalone': median(commit_2_compile_ratio_for_standal) }
2025-06-30 17:18:32.261
2025-06-30 17:18:32.274 for ftype in ('packaged', 'standalone'):
2025-06-30 17:18:32.286 msg = f"Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} {ftype} PSQL objects: "
2025-06-30 17:18:32.296 if actual_time_ratios_commit2compile[ ftype ] < MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]:
2025-06-30 17:18:32.304 print( msg + 'acceptable')
2025-06-30 17:18:32.311 else:
2025-06-30 17:18:32.318 print( msg + '/* perf_issue_tag */ UNACCEPTABLE: %12.2f -- greater than threshold = %12.2f' % (actual_time_ratios_commit2compile[ ftype ], MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]) )
2025-06-30 17:18:32.325 print( 'Check result of %d measures:' % N_MEASURES )
2025-06-30 17:18:32.331
2025-06-30 17:18:32.338 # List with concrete values (source for median evaluation):
2025-06-30 17:18:32.350 lst = commit_2_compile_ratio_for_package if ftype == 'packaged' else commit_2_compile_ratio_for_standal
2025-06-30 17:18:32.359 for i,p in enumerate(lst):
2025-06-30 17:18:32.366 print('%3d' % i, ':', '%12.2f' % p)
2025-06-30 17:18:32.379
2025-06-30 17:18:32.390
2025-06-30 17:18:32.397 act.expected_stdout = expected_stdout
2025-06-30 17:18:32.403 act.stdout = capsys.readouterr().out
2025-06-30 17:18:32.408 > assert act.clean_stdout == act.clean_expected_stdout
2025-06-30 17:18:32.412 E assert
2025-06-30 17:18:32.423 E - Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
2025-06-30 17:18:32.430 E + Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.55 -- greater than threshold = 0.55
2025-06-30 17:18:32.435 E + Check result of 21 measures:
2025-06-30 17:18:32.440 E + 0 : 0.54
2025-06-30 17:18:32.445 E + 1 : 0.51
2025-06-30 17:18:32.450 E + 2 : 0.55
2025-06-30 17:18:32.455 E + 3 : 0.55
2025-06-30 17:18:32.461 E + 4 : 0.50
2025-06-30 17:18:32.466 E + 5 : 0.52
2025-06-30 17:18:32.479 E + 6 : 0.55
2025-06-30 17:18:32.490 E + 7 : 0.48
2025-06-30 17:18:32.498 E + 8 : 0.59
2025-06-30 17:18:32.508 E + 9 : 0.53
2025-06-30 17:18:32.517 E + 10 : 0.51
2025-06-30 17:18:32.524 E + 11 : 0.55
2025-06-30 17:18:32.531 E + 12 : 0.53
2025-06-30 17:18:32.538 E + 13 : 0.61
2025-06-30 17:18:32.546 E + 14 : 0.55
2025-06-30 17:18:32.553 E + 15 : 0.73
2025-06-30 17:18:32.563 E + 16 : 0.68
2025-06-30 17:18:32.575 E + 17 : 0.55
2025-06-30 17:18:32.583 E + 18 : 0.55
2025-06-30 17:18:32.591 E + 19 : 0.52
2025-06-30 17:18:32.599 E + 20 : 0.59
2025-06-30 17:18:32.606 E Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
2025-06-30 17:18:32.616
2025-06-30 17:18:32.627 tests/bugs/core_4880_test.py:164: AssertionError
2025-06-30 17:18:32.635 ---------------------------- Captured stdout setup -----------------------------
2025-06-30 17:18:32.642 Creating db: localhost:/var/tmp/qa_2024/test_1966/test.fdb [page_size=None, sql_dialect=None, charset='NONE', user=SYSDBA, password=masterkey]
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=3.0')
def test_1(act: Action, capsys):
act.db.set_async_write() # just to be sure, although this is by default
expected_stdout = f"""
Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} packaged PSQL objects: acceptable
Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} standalone PSQL objects: acceptable
"""
func_headers_ddl = ''.join( [ '\n function fn_%d returns int;' % i for i in range(N_LIMIT) ] )
func_bodies_ddl = ''.join( [ '\n function fn_%d returns int as begin return %d; end' % (i,i) for i in range(N_LIMIT) ] )
pkg_header_ddl = '\n'.join( ('create or alter package huge as\nbegin', func_headers_ddl, 'end') )
pkg_body_ddl = '\n'.join( ('recreate package body huge as\nbegin', func_bodies_ddl, 'end') )
sp_time = {}
with act.db.connect() as con:
with con.cursor() as cur:
cur.execute('select mon$server_pid as p from mon$attachments where mon$attachment_id = current_connection')
fb_pid = int(cur.fetchone()[0])
for i in range(0, N_MEASURES):
for ftype in ('packaged', 'standalone'):
fb_info_a = psutil.Process(fb_pid).cpu_times()
if ftype == 'packaged':
con.execute_immediate(pkg_header_ddl)
con.execute_immediate(pkg_body_ddl)
else:
for k in range(0,N_LIMIT):
con.execute_immediate( 'create or alter function sf_%d returns int as begin return %d; end' % (k,k) )
fb_info_b = psutil.Process(fb_pid).cpu_times()
con.commit()
fb_info_c = psutil.Process(fb_pid).cpu_times()
cpu_time_for_compile = max(fb_info_b.user - fb_info_a.user, 0.000001)
cpu_time_for_commit = fb_info_c.user - fb_info_b.user
sp_time[ ftype, i ] = cpu_time_for_commit / cpu_time_for_compile
commit_2_compile_ratio_for_package = [round(v,2) for k,v in sp_time.items() if k[0] == 'packaged']
commit_2_compile_ratio_for_standal = [round(v,2) for k,v in sp_time.items() if k[0] == 'standalone']
actual_time_ratios_commit2compile = { 'packaged' : median(commit_2_compile_ratio_for_package), 'standalone': median(commit_2_compile_ratio_for_standal) }
for ftype in ('packaged', 'standalone'):
msg = f"Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} {ftype} PSQL objects: "
if actual_time_ratios_commit2compile[ ftype ] < MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]:
print( msg + 'acceptable')
else:
print( msg + '/* perf_issue_tag */ UNACCEPTABLE: %12.2f -- greater than threshold = %12.2f' % (actual_time_ratios_commit2compile[ ftype ], MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]) )
print( 'Check result of %d measures:' % N_MEASURES )
# List with concrete values (source for median evaluation):
lst = commit_2_compile_ratio_for_package if ftype == 'packaged' else commit_2_compile_ratio_for_standal
for i,p in enumerate(lst):
print('%3d' % i, ':', '%12.2f' % p)
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
> assert act.clean_stdout == act.clean_expected_stdout
E assert
E - Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
E + Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.55 -- greater than threshold = 0.55
E + Check result of 21 measures:
E + 0 : 0.54
E + 1 : 0.51
E + 2 : 0.55
E + 3 : 0.55
E + 4 : 0.50
E + 5 : 0.52
E + 6 : 0.55
E + 7 : 0.48
E + 8 : 0.59
E + 9 : 0.53
E + 10 : 0.51
E + 11 : 0.55
E + 12 : 0.53
E + 13 : 0.61
E + 14 : 0.55
E + 15 : 0.73
E + 16 : 0.68
E + 17 : 0.55
E + 18 : 0.55
E + 19 : 0.52
E + 20 : 0.59
E Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
tests/bugs/core_4880_test.py:164: AssertionError
|