This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [python] Optimize python_string_to_host_string() for Python 2.


Hello,

First of all, sorry about the delay in review this. I was hoping
that someone more knowledgeable than I would be able to review it.
Thanks for ping us, and for your patience!

> I have been writing quite some advanced GDB Python tools for LuaJIT
> and NGINX in the nginx-gdb-utils project [1] and have been suffering
> from serious performance issues even for relatively small working sets.
> 
> I have noticed from a typical on-CPU C-land Flame Graph [2]
> for my tools that python_string_to_host_string() is painfully slow
> when using Python 2 (2.7 to be more specific) due to the
> expensive and meaningless unicode conversions there (involved with
> hot function calls like utf_8_decode).
[...]
> gdb/ChangeLog:
> 
>     * python/py-utils.c (python_string_to_host_string): use
>     xstrdup directly for Python 2.
>     * python/py-utils.c (gdbpy_obj_to_string): use
>     python_string_to_host_string for both Python 2 and 3.

I believe you, but being a fairly complete dummy in this area,
can you explain why the unicode conversion is meaningless with
Python 2? In fact, if you have that explanation, I think it would
be useful to have that as a comment inside the Python-2 part of
python_string_to_host_string.

Thanks,
-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]