Open Bug 330350 Opened 19 years ago Updated 2 years ago

Rendering a large bidi plaintext file still takes a very long time


(Core :: Layout: Text and Fonts, defect)





(Reporter: uriber, Unassigned)


(Blocks 1 open bug)


(Keywords: perf)

This is a follow-up on bug 319930 and bug 329878.

Very large bidi plaintext files (e.g. attachment 205680 [details] on bug 319930) still take about 13-15 times longer to render than non-bidi files of the same size (e.g., the same file in Latin-1 or EUC-JP).

On my machine (iMac G5 1.8Ghz), this file currently (after fixing bug 319930 and  bug 329878) takes 72 seconds to render. In Latin-1 encoding, the same file takes about 5.5 seconds.

A current profiling report (after fixing these two bugs) can be found in attachment 214707 [details] (bug 329878 comment 9).

A suspected reason for the slowness is that in the bidi case it seems like the entire existing part of the document is reflowed for each incremental reflow. Normally only the last line of the <pre> and maybe the one before that would be marked dirty and reflowed. Fixing bug 263359 might help resolving this.
OK, so what's happening here is that we hit the code at and that of course kills any hopes of decent perf that we might have had.

So it seems to me that what bidi _really_ wants here is to dirty just the lines that contain frames whose continuations got messed with, right?

Do we have any sane way of doing that?
I should also note that _inserting_ bidi continuations (via CreateBidiContinuation) already marks relevant lines dirty.  So it's just RemoveBidiContinuation() that needs to do dirtying, and then we can remove this "force reflow" stuff.
It should be pretty easy to call ReflowDirtyChild on the right frames.

I'm not pleased with the performance of ReflowDirtyChild, however, so it could become a new bottleneck. But if so, that sounds like a post-reflow-branch issue.
Calling ReflowDirtyChild will post another reflow command, from inside reflow.  We don't really want that....  Post-reflow-branch that might be easier, of course.
Depends on: 330373
OK, with bug 330373 it looks like we're marking lots of lines dirty because our run lengths are smaller than the fragment lengths (so we're calling EnsureBidiContinuation and then dirtying the line).

Could we perhaps have EnsureBidiContinuation output whether something's changed?  Or something like that?  That is, do we always have to dirty the line here?  Note that I'm not sure why bug 329878 actually happened.  That is, why did the in-flows need to be removed in that case?
Component: Layout: BiDi Hebrew & Arabic → Layout: Text
QA Contact: zach → layout.fonts-and-text
Depends on: 646359
Assignee: mozilla → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.