GithubHelp home page GithubHelp logo

Comments (7)

fruxo avatar fruxo commented on July 30, 2024

What is taking time in TBTextFragment::Paint then?
Are you using many fonts? I guess the GetFont call in it could be slow.

I haven't had any performance problems with it.
For normal text, there shouldn't be many text fragments. But with things like many word-breaking characters, it could be pretty bad, resulting in one fragment per character. Imagine f.ex a line like "====================================="

Avoiding fragments unless styling or wrapping requires it would be an interesting optimization.

from turbobadger.

fruxo avatar fruxo commented on July 30, 2024

27ms spent in TBEditField::OnPaint seems insanely slow but i guess profiling itself made it a lot slower?

from turbobadger.

codecat avatar codecat commented on July 30, 2024

No, that's the entire reason I started profiling it. The profiler I'm using has an overhead of about ~50us if I remember correctly (per begin/end call for the zones).

The text in question was a relatively simple piece of text with average word lengths, nothing super long like that. There's some word wrapping involved though.

The font used is a Truetype font, too. Perhaps that has something to do with it, but considering it caches all the characters on a bitmap I don't think that could be the issue.

from turbobadger.

fruxo avatar fruxo commented on July 30, 2024

I did some profiling on master and made some optimizations (will try to push something within a few days..). However, on the shape rasterizer branch, the new kerning support is adding 30% cost for drawing text compared to the nonkerned version on master (all in GetAdvance). That's with STBFontRenderer. I haven't tried freetype. Maybe glyph advances should be cached.

TBEditField doesn't measure during painting though, so that doesn't really explain this issue.

from turbobadger.

codecat avatar codecat commented on July 30, 2024

Thank you! I had a suspicion that the rasterizer branch would have some changes that caused it to be a bit slower. I'll have to try and revert our codebase back to master branch and see if that solves the issue.

from turbobadger.

Cleroth avatar Cleroth commented on July 30, 2024

@codecat What is that profiler? It looks quite nice.

from turbobadger.

codecat avatar codecat commented on July 30, 2024

It's actually an in-house profiler that we made at @Crackshell that we've wanted to release as an open source project, but never got around to it yet.

from turbobadger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.