Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow disassembly speed on some files #4126

Closed
XVilka opened this issue Jan 18, 2024 · 2 comments · Fixed by #4129
Closed

Very slow disassembly speed on some files #4126

XVilka opened this issue Jan 18, 2024 · 2 comments · Fixed by #4129

Comments

@XVilka
Copy link
Member

XVilka commented Jan 18, 2024

Sometimes pdf or other pd commands, including visual mode scrolling appear very slow, taking visible delay for every line. Profiling pointed to the function ds_print_debuginfo in librz/core/disasm.c and the particular reason - rz_bin_addr2text() that calls very slow functions inside: rz_file_slurp() and rz_file_exists().

Note also, both rz_bin_addr2line() and rz_bin_addr2text() marked as deprecated and their use should be eliminated, they are removed.

It should not happen for every line, in my opinion. We should find better way to cache this information. On some files with a lot of debug lines information it makes Rizin/Cutter unusable:

419	rizin (74894)	
419	start	
419	rz_main_rizin	
419	rz_core_prompt_loop	
419	z_core_prompt_exec [inlined]	
419	rz_core_cmd	
419	z_cmd_status2int [inlined]	
419	core_cmd_tsrzcmd	
419	handle_ts_statements	
419	andle_ts_statements_internal [inlined]	
419	handle_ts_stmt	
419	handle_ts_arged_stmt	
419	andle_ts_arged_stmt_internal [inlined]	
419	rz_cmd_call_parsed_args	
419	all_cd [inlined]	
419	nt2cmdstatus [inlined]	
419	rz_core_visual	
419	rz_core_visual_cmd	
419	rz_core_visual_analysis	
416	rz_core_visual_analysis_refresh	
409	z_core_visual_analysis_refresh_column [inlined]	
409	core_cmd_raw	
409	rz_core_cmd [inlined]	
409	z_cmd_status2int [inlined]	
409	core_cmd_tsrzcmd	
406	handle_ts_statements	
406	andle_ts_statements_internal [inlined]	
406	handle_ts_stmt	
406	handle_ts_tmp_seek_stmt	
405	andle_ts_tmp_seek_stmt_internal [inlined]	
405	andle_ts_stmt_tmpseek [inlined]	
405	handle_ts_stmt	
405	handle_ts_arged_stmt	
405	andle_ts_arged_stmt_internal [inlined]	
405	rz_cmd_call_parsed_args	
405	all_cd [inlined]	
405	rgv_call_cb [inlined]	
346	rz_cmd_disassembly_function_handler	
345	rz_core_print_disasm	
182	s_print_middle [inlined]	
182	ds_print_debuginfo	
165	rz_bin_addr2text	
160	rz_file_slurp_line	
160	rz_file_slurp	
160	rz_file_exists	
131	z_file_abspath [inlined]	
76	__private_getcwd	
76	__getcwd	
48	open$NOCANCEL	
47	__open_nocancel	
@wargio
Copy link
Member

wargio commented Jan 18, 2024

can you provide commands and bin to test this?

@Rot127 Rot127 added the performance A performance problem/enhancement label Jan 18, 2024
@XVilka
Copy link
Member Author

XVilka commented Jan 18, 2024

@wargio - no, commands are pd or pdf, or visual modes - doesn't matter, see the profile trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants