Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: "Yichun Zhang (agentzh)" <agentzh@gmail.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [python] Optimize python_string_to_host_string() for Python 2.
Date: Tue, 03 Mar 2015 16:12:00 -0000	[thread overview]
Message-ID: <20150303161157.GC3243@adacore.com> (raw)
In-Reply-To: <1421217481-18204-1-git-send-email-agentzh@gmail.com>

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


      parent reply	other threads:[~2015-03-03 16:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14  6:38 Yichun Zhang (agentzh)
2015-01-19 22:08 ` Yichun Zhang (agentzh)
2015-01-20 11:13   ` Phil Muldoon
2015-01-20 13:13     ` Joel Brobecker
2015-01-20 22:19       ` Yichun Zhang (agentzh)
2015-02-01 23:33 ` Yichun Zhang (agentzh)
2015-02-22 18:01 ` Yichun Zhang (agentzh)
2015-03-03 16:12 ` Joel Brobecker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150303161157.GC3243@adacore.com \
    --to=brobecker@adacore.com \
    --cc=agentzh@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox