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 standalone PSQL objects: acceptable
+ Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.56 -- greater than threshold = 0.55
+ Check result of 21 measures:
+ 0 : 0.50
+ 1 : 0.54
+ 2 : 0.59
+ 3 : 0.55
+ 4 : 0.57
+ 5 : 0.61
+ 6 : 0.54
+ 7 : 0.57
+ 8 : 0.59
+ 9 : 0.54
+ 10 : 0.58
+ 11 : 0.56
+ 12 : 0.56
+ 13 : 0.55
+ 14 : 0.58
+ 15 : 0.56
+ 16 : 0.58
+ 17 : 0.49
+ 18 : 0.59
+ 19 : 0.62
+ 20 : 0.53
+ Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.62 -- greater than threshold = 0.50
+ Check result of 21 measures:
+ 0 : 1.02
+ 1 : 0.56
+ 2 : 0.60
+ 3 : 0.60
+ 4 : 0.62
+ 5 : 0.67
+ 6 : 0.61
+ 7 : 0.60
+ 8 : 0.61
+ 9 : 0.62
+ 10 : 0.65
+ 11 : 0.63
+ 12 : 0.62
+ 13 : 0.61
+ 14 : 0.58
+ 15 : 0.55
+ 16 : 0.64
+ 17 : 0.64
+ 18 : 0.57
+ 19 : 0.62
+ 20 : 0.65
LOG DETAILS:
2024-05-12 18:17:11.964
2024-05-12 18:17:11.970 act = <firebird.qa.plugin.Action object at [hex]>
2024-05-12 18:17:11.977 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-05-12 18:17:11.984
2024-05-12 18:17:12.004 @pytest.mark.version('>=3.0')
2024-05-12 18:17:12.024 def test_1(act: Action, capsys):
2024-05-12 18:17:12.038
2024-05-12 18:17:12.057 act.db.set_async_write() # just to be sure, although this is by default
2024-05-12 18:17:12.084
2024-05-12 18:17:12.100 expected_stdout = f"""
2024-05-12 18:17:12.113 Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} packaged PSQL objects: acceptable
2024-05-12 18:17:12.120 Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} standalone PSQL objects: acceptable
2024-05-12 18:17:12.126 """
2024-05-12 18:17:12.132
2024-05-12 18:17:12.138 func_headers_ddl = ''.join( [ '\n function fn_%d returns int;' % i for i in range(N_LIMIT) ] )
2024-05-12 18:17:12.144 func_bodies_ddl = ''.join( [ '\n function fn_%d returns int as begin return %d; end' % (i,i) for i in range(N_LIMIT) ] )
2024-05-12 18:17:12.149
2024-05-12 18:17:12.156 pkg_header_ddl = '\n'.join( ('create or alter package huge as\nbegin', func_headers_ddl, 'end') )
2024-05-12 18:17:12.162 pkg_body_ddl = '\n'.join( ('recreate package body huge as\nbegin', func_bodies_ddl, 'end') )
2024-05-12 18:17:12.167
2024-05-12 18:17:12.173 sp_time = {}
2024-05-12 18:17:12.179 with act.db.connect() as con:
2024-05-12 18:17:12.185
2024-05-12 18:17:12.191 with con.cursor() as cur:
2024-05-12 18:17:12.197 cur.execute('select mon$server_pid as p from mon$attachments where mon$attachment_id = current_connection')
2024-05-12 18:17:12.202 fb_pid = int(cur.fetchone()[0])
2024-05-12 18:17:12.209
2024-05-12 18:17:12.215 for i in range(0, N_MEASURES):
2024-05-12 18:17:12.221 for ftype in ('packaged', 'standalone'):
2024-05-12 18:17:12.227
2024-05-12 18:17:12.233 fb_info_a = psutil.Process(fb_pid).cpu_times()
2024-05-12 18:17:12.239 if ftype == 'packaged':
2024-05-12 18:17:12.245 con.execute_immediate(pkg_header_ddl)
2024-05-12 18:17:12.251 con.execute_immediate(pkg_body_ddl)
2024-05-12 18:17:12.257 else:
2024-05-12 18:17:12.263 for k in range(0,N_LIMIT):
2024-05-12 18:17:12.269 con.execute_immediate( 'create or alter function sf_%d returns int as begin return %d; end' % (k,k) )
2024-05-12 18:17:12.275
2024-05-12 18:17:12.281 fb_info_b = psutil.Process(fb_pid).cpu_times()
2024-05-12 18:17:12.287 con.commit()
2024-05-12 18:17:12.293 fb_info_c = psutil.Process(fb_pid).cpu_times()
2024-05-12 18:17:12.300
2024-05-12 18:17:12.306 cpu_time_for_compile = max(fb_info_b.user - fb_info_a.user, 0.000001)
2024-05-12 18:17:12.313 cpu_time_for_commit = fb_info_c.user - fb_info_b.user
2024-05-12 18:17:12.319
2024-05-12 18:17:12.325 sp_time[ ftype, i ] = cpu_time_for_commit / cpu_time_for_compile
2024-05-12 18:17:12.332
2024-05-12 18:17:12.338 commit_2_compile_ratio_for_package = [round(v,2) for k,v in sp_time.items() if k[0] == 'packaged']
2024-05-12 18:17:12.344 commit_2_compile_ratio_for_standal = [round(v,2) for k,v in sp_time.items() if k[0] == 'standalone']
2024-05-12 18:17:12.350
2024-05-12 18:17:12.357 actual_time_ratios_commit2compile = { 'packaged' : median(commit_2_compile_ratio_for_package), 'standalone': median(commit_2_compile_ratio_for_standal) }
2024-05-12 18:17:12.363
2024-05-12 18:17:12.369 for ftype in ('packaged', 'standalone'):
2024-05-12 18:17:12.375 msg = f"Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} {ftype} PSQL objects: "
2024-05-12 18:17:12.382 if actual_time_ratios_commit2compile[ ftype ] < MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]:
2024-05-12 18:17:12.388 print( msg + 'acceptable')
2024-05-12 18:17:12.394 else:
2024-05-12 18:17:12.400 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 ]) )
2024-05-12 18:17:12.406 print( 'Check result of %d measures:' % N_MEASURES )
2024-05-12 18:17:12.410
2024-05-12 18:17:12.415 # List with concrete values (source for median evaluation):
2024-05-12 18:17:12.419 lst = commit_2_compile_ratio_for_package if ftype == 'packaged' else commit_2_compile_ratio_for_standal
2024-05-12 18:17:12.424 for i,p in enumerate(lst):
2024-05-12 18:17:12.428 print('%3d' % i, ':', '%12.2f' % p)
2024-05-12 18:17:12.433
2024-05-12 18:17:12.437
2024-05-12 18:17:12.442 act.expected_stdout = expected_stdout
2024-05-12 18:17:12.446 act.stdout = capsys.readouterr().out
2024-05-12 18:17:12.451 > assert act.clean_stdout == act.clean_expected_stdout
2024-05-12 18:17:12.455 E assert
2024-05-12 18:17:12.461 E - Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
2024-05-12 18:17:12.466 E - Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
2024-05-12 18:17:12.471 E + Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.56 -- greater than threshold = 0.55
2024-05-12 18:17:12.476 E + Check result of 21 measures:
2024-05-12 18:17:12.481 E + 0 : 0.50
2024-05-12 18:17:12.485 E + 1 : 0.54
2024-05-12 18:17:12.490 E + 2 : 0.59
2024-05-12 18:17:12.495 E + 3 : 0.55
2024-05-12 18:17:12.500 E + 4 : 0.57
2024-05-12 18:17:12.504 E + 5 : 0.61
2024-05-12 18:17:12.509 E + 6 : 0.54
2024-05-12 18:17:12.514 E + 7 : 0.57
2024-05-12 18:17:12.520 E + 8 : 0.59
2024-05-12 18:17:12.525 E + 9 : 0.54
2024-05-12 18:17:12.529 E + 10 : 0.58
2024-05-12 18:17:12.534 E + 11 : 0.56
2024-05-12 18:17:12.539 E + 12 : 0.56
2024-05-12 18:17:12.544 E + 13 : 0.55
2024-05-12 18:17:12.548 E + 14 : 0.58
2024-05-12 18:17:12.553 E + 15 : 0.56
2024-05-12 18:17:12.558 E + 16 : 0.58
2024-05-12 18:17:12.562 E + 17 : 0.49
2024-05-12 18:17:12.567 E + 18 : 0.59
2024-05-12 18:17:12.572 E + 19 : 0.62
2024-05-12 18:17:12.577 E + 20 : 0.53
2024-05-12 18:17:12.582 E + Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.62 -- greater than threshold = 0.50
2024-05-12 18:17:12.587 E + Check result of 21 measures:
2024-05-12 18:17:12.592 E + 0 : 1.02
2024-05-12 18:17:12.597 E + 1 : 0.56
2024-05-12 18:17:12.602 E + 2 : 0.60
2024-05-12 18:17:12.607 E + 3 : 0.60
2024-05-12 18:17:12.612 E + 4 : 0.62
2024-05-12 18:17:12.617 E + 5 : 0.67
2024-05-12 18:17:12.621 E + 6 : 0.61
2024-05-12 18:17:12.626 E + 7 : 0.60
2024-05-12 18:17:12.631 E + 8 : 0.61
2024-05-12 18:17:12.636 E + 9 : 0.62
2024-05-12 18:17:12.640 E + 10 : 0.65
2024-05-12 18:17:12.645 E + 11 : 0.63
2024-05-12 18:17:12.650 E + 12 : 0.62
2024-05-12 18:17:12.655 E + 13 : 0.61
2024-05-12 18:17:12.660 E + 14 : 0.58
2024-05-12 18:17:12.664 E + 15 : 0.55
2024-05-12 18:17:12.669 E + 16 : 0.64
2024-05-12 18:17:12.673 E + 17 : 0.64
2024-05-12 18:17:12.678 E + 18 : 0.57
2024-05-12 18:17:12.683 E + 19 : 0.62
2024-05-12 18:17:12.687 E + 20 : 0.65
2024-05-12 18:17:12.692
2024-05-12 18:17:12.697 tests/bugs/core_4880_test.py:164: AssertionError
2024-05-12 18:17:12.701 ---------------------------- Captured stdout setup -----------------------------
2024-05-12 18:17:12.706 Cached db: db-12.0-None-None-NONE.fdb [page_size=None, sql_dialect=None, charset='NONE'
|
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 standalone 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.56 -- greater than threshold = 0.55
E + Check result of 21 measures:
E + 0 : 0.50
E + 1 : 0.54
E + 2 : 0.59
E + 3 : 0.55
E + 4 : 0.57
E + 5 : 0.61
E + 6 : 0.54
E + 7 : 0.57
E + 8 : 0.59
E + 9 : 0.54
E + 10 : 0.58
E + 11 : 0.56
E + 12 : 0.56
E + 13 : 0.55
E + 14 : 0.58
E + 15 : 0.56
E + 16 : 0.58
E + 17 : 0.49
E + 18 : 0.59
E + 19 : 0.62
E + 20 : 0.53
E + Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.62 -- greater than threshold = 0.50
E + Check result of 21 measures:
E + 0 : 1.02
E + 1 : 0.56
E + 2 : 0.60
E + 3 : 0.60
E + 4 : 0.62
E + 5 : 0.67
E + 6 : 0.61
E + 7 : 0.60
E + 8 : 0.61
E + 9 : 0.62
E + 10 : 0.65
E + 11 : 0.63
E + 12 : 0.62
E + 13 : 0.61
E + 14 : 0.58
E + 15 : 0.55
E + 16 : 0.64
E + 17 : 0.64
E + 18 : 0.57
E + 19 : 0.62
E + 20 : 0.65
tests/bugs/core_4880_test.py:164: AssertionError
|