NSTextView/text system slowdown on Leopard

  • Hi,

    Some of my users on older machines - G4s with less than 1.5GhZ processors - have been reporting a massive slowdown of typing in my app since upgrading to Leopard. I originally built this application on a 1Ghz G4 iBook and ensured it was fast. However, upgrading that iBook to Leopard and testing on it again confirms what users have told me - code that ran quickly on Leopard is much slower on Tiger.

    I discussed this with another developer and he tells me that from his own observations, it seems that Tiger used to coalesce keystrokes so that it did not attempt to draw at every stroke, whereas Leopard draws all the time. I'm aware that the text system has been optimised for Leopard, but it seems to cause problems for older PPC machines.

    Is there anything I can do about this? I can reproduce the slowdown in almost any app that uses an NSTextSystem. If I unplug my iBook to use less processing power, then paste a couple of thousand words into TextEdit and start typing somewhere inside the text (works fine at the bottom), typing is a slow trudge, with drawing struggling to keep up with my key strokes. There was no such problem on Tiger.

    So, I'm just wondering if, 1) this is an issue that I need to file a bug report on, or 2) there is something I can do to optimise the performance of text in Leopard for slower machines.

    Thanks in advance and all the best,
    Keith

          ____________________________________________________________________________________
    Looking for last minute shopping deals?
    Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
  • > I discussed this with another developer and he tells me that from his own observations, it seems that Tiger used to coalesce keystrokes so that it did not attempt to draw at every stroke, whereas Leopard draws all the time. I'm aware that the text system has been optimised for Leopard, but it seems to cause problems for older PPC machines.

      Have you profiled your code with the shiny new Instruments.app or
    are you assuming it's the text system? :-)

    --
    I.S.
  • On Feb 4, 2008, at 12:40 PM, Keith Blount wrote:

    > Is there anything I can do about this? I can reproduce the slowdown
    > in almost any app that uses an NSTextSystem. If I unplug my iBook to
    > use less processing power, then paste a couple of thousand words
    > into TextEdit and start typing somewhere inside the text (works fine
    > at the bottom), typing is a slow trudge, with drawing struggling to
    > keep up with my key strokes. There was no such problem on Tiger.
    >
    >
    > So, I'm just wondering if, 1) this is an issue that I need to file a
    > bug report on, or 2) there is something I can do to optimise the
    > performance of text in Leopard for slower machines.

    File a bug report, the more specific the better.

    Douglas Davidson
  • > Is there anything I can do about this? I can reproduce the slowdown in almost any app that uses an NSTextSystem. If I unplug my iBook to use less processing power, then paste a couple of thousand words into TextEdit and start typing somewhere inside the text (works fine at the bottom), typing is a slow trudge, with drawing struggling to keep up with my key strokes. There was no such problem on Tiger.

      My apologies - I didn't address this part. On its surface, it
    appears the problem is not specific to your app, but rather could be
    the way you're using it. Profiling would give you a much better idea
    of where the problem actually is.

    --
    I.S.
  • Many thanks for your replies.

    Apologies if my post was a bit vaguer than it should have been. I should have clarified that I tested this on numerous apps that use the text system - Bean, WriteRoom, iText Express and others, along with my own - and that they all showed the same symptoms to varying degrees. I also spent a lot of time isolating sections of my own code that would add processing time to typing, but no individual section of code had a big impact. It seems to be cumulative. Also, I gave a test app isolating the text system part of my app (a heavily subclassed NSTextView, layout manager and text storage) to a couple of users running G4s of different specs to see if it was that causing slowdown or other parts of my larger app. But I got conflicting reports - some said that didn't lag as much as when with the rest of the app, some said not at all, others said as much. Likewise, others report varying results from other Cocoa NSTextView apps - some have big lags in those, others
    not so much. Hence I wondered if this was something known and whether I had missed something in the release notes about new optimisation techniques/necessities.

    Anyway, I have filed a bug as suggested explaining how to reproduce this in TextEdit.

    Thanks again and all the best,
    Keith

    ----- Original Message ----
    From: I. Savant <idiotsavant2005...>
    To: Keith Blount <keithblount...>
    Cc: <cocoa-dev...>
    Sent: Monday, February 4, 2008 8:47:16 PM
    Subject: Re: NSTextView/text system slowdown on Leopard

    >
    Is
    there
    anything
    I
    can
    do
    about
    this?
    I
    can
    reproduce
    the
    slowdown
    in
    almost
    any
    app
    that
    uses
    an
    NSTextSystem.
    If
    I
    unplug
    my
    iBook
    to
    use
    less
    processing
    power,
    then
    paste
    a
    couple
    of
    thousand
    words
    into
    TextEdit
    and
    start
    typing
    somewhere
    inside
    the
    text
    (works
    fine
    at
    the
    bottom),
    typing
    is
    a
    slow
    trudge,
    with
    drawing
    struggling
    to
    keep
    up
    with
    my
    key
    strokes.
    There
    was
    no
    such
    problem
    on
    Tiger.


    My
    apologies
    -
    I
    didn't
    address
    this
    part.
    On
    its
    surface,
    it
    appears
    the
    problem
    is
    not
    specific
    to
    your
    app,
    but
    rather
    could
    be
    the
    way
    you're
    using
    it.
    Profiling
    would
    give
    you
    a
    much
    better
    idea
    of
    where
    the
    problem
    actually
    is.

    --
    I.S.

          ____________________________________________________________________________________
    Be a better friend, newshound, and
    know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ