PERFORMANCE <textarea>'s combos (ultra-low priority)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

PERFORMANCE <textarea>'s combos (ultra-low priority)

Alejandro Torras
Hi all,

The key-combos CTRL+(left/right arrows) don't work at the same speed.

It's funny to see that CTRL+left arrow is faster than CTRL+right arrow
in a <textarea> in FireFox/Linux/kde3.4.

I tested it on a text and CTRL+right needs 1:47, but CTRL+left needs
only 0:40!! About twice faster!! ;-)

Does anybody have experienced the same issue?

Regards

--
Alejandro Torras
http://dynamic-interactive.com
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Boris Zbarsky
Alejandro Torras wrote:
> It's funny to see that CTRL+left arrow is faster than CTRL+right arrow
> in a <textarea> in FireFox/Linux/kde3.4.

Out of curiousity, does your difference in time between Ctrl+right and Ctrl+left
depend on how much text is in the textarea before the caret?

-Boris
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Alejandro Torras
Boris Zbarsky wrote:
> Alejandro Torras wrote:
>> It's funny to see that CTRL+left arrow is faster than CTRL+right arrow
[...]
> Out of curiousity, does your difference in time between Ctrl+right and
> Ctrl+left depend on how much text is in the textarea before the caret?

Hello Boris,

There's the same text all the time.

I started from the beginning to the end and viceversa.

--
Alejandro Torras
http://dynamic-interactive.com
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Boris Zbarsky
Alejandro Torras wrote:
>> Out of curiousity, does your difference in time between Ctrl+right and
>> Ctrl+left depend on how much text is in the textarea before the caret?
>
> There's the same text all the time.

That doesn't answer my question.

> I started from the beginning to the end and viceversa.

So you're timing the amount of time it takes to walk along all the text, not a
single operation?

That's pretty much guaranteed to be faster when walking forward than backward --
walking a singly-linked list (as here) backward is O(N^2) in length, while
walking it forward is O(N).

-Boris
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Alejandro Torras
Boris Zbarsky wrote:
[...]
> So you're timing the amount of time it takes to walk along all the text,
> not a single operation?

Right.

> That's pretty much guaranteed to be faster when walking forward than
> backward -- walking a singly-linked list (as here) backward is O(N^2) in
> length, while walking it forward is O(N).

I didn't know that strings in textareas are handled by singly-linked
lists. It's nice to know it :-)

I agree with you that O(N^2) is faster than O(N) but my test doesn't
match with the theory.

I think that there are two things that might happen:
1) A lot of calls are done with CTRL+right that slow the operation
(maybe FFox side, maybe KDE's keyboard handler)
2) If data structure is OK and keyb-handler overhead is OK then I miss
something important (scheduling, caches, etc...)

I have tested it again and I get the same performance difference.

--
Alejandro Torras
http://dynamic-interactive.com
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Boris Zbarsky
Alejandro Torras wrote:
> I didn't know that strings in textareas are handled by singly-linked
> lists. It's nice to know it :-)

Not strings in textareas per se.  All layout objects, period.  It's a tree, with
the children of any given node being a singly linked list.

> I agree with you that O(N^2) is faster than O(N) but my test doesn't
> match with the theory.

Hmm.  You came out with moving to the right being slower, eh?

You could try profiling.  If you can't figure out how, point me to a testcase
and I could try it...

-Boris
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Alejandro Torras
Boris Zbarsky wrote:
> Alejandro Torras wrote:
>> I didn't know that strings in textareas are handled by singly-linked
>> lists. It's nice to know it :-)
>
> Not strings in textareas per se.  All layout objects, period.  It's a
> tree, with the children of any given node being a singly linked list.

Do you point the DOM tree?

... so singly linked list makes random access to DOM nodes, deletions
and parentNode() access are O(N)? :-m

I think I will avoid use them in the future...

[...]
> Hmm.  You came out with moving to the right being slower, eh?
>
> You could try profiling.  If you can't figure out how, point me to a
> testcase and I could try it...

I am not a hardcore developer nor a hacker and I have never downloaded
the code of firefox and compiled it.

By now I have started to run firefox in console and then attach gdb to
catch bugs and paste some information.

How can I profile firefox? Does it come with profiling info?
Gprof is even lesser user-friendly than gdb.

It remembers me the days I used to hang my PC with the TD32.EXE :-D

Regards.

PS: It could be nice to attach some kind of logger at the DOM level to
catch every change, mutation, assignment; it could be far more better
than posting stack traces...

--
Alejandro Torras
http://dynamic-interactive.com
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Boris Zbarsky
Alejandro Torras wrote:
>> Not strings in textareas per se.  All layout objects, period.  It's a
>> tree, with the children of any given node being a singly linked list.
>
> Do you point the DOM tree?

No, the rendering tree.  They're not the same thing.

> How can I profile firefox? Does it come with profiling info?

http://www.mozilla.org/performance/tools.html#profiling

On Linux, building Firefox with jprof and using it are pretty straightforward...

Again, if you don't really want to deal, give me enough information to reproduce
the issue and I can do it.

-Boris
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance
Reply | Threaded
Open this post in threaded view
|

Re: PERFORMANCE <textarea>'s combos (ultra-low priority)

Alejandro Torras
Boris Zbarsky wrote:
> Alejandro Torras wrote:
>
[...]

>> How can I profile firefox? Does it come with profiling info?
>
>
> http://www.mozilla.org/performance/tools.html#profiling
>
> On Linux, building Firefox with jprof and using it are pretty
> straightforward...
>
> Again, if you don't really want to deal, give me enough information to
> reproduce the issue and I can do it.

I have tested it in windows and it doesn't behave like it's linux
counterpart...

Thank you for your support. I'll play with it :-)

After I posted my message I looked to differents profilers for linux and
found that oprofile was the best choice for me.

http://oprofile.sourceforge.net/news/

Maybe mozilla's profiling zone should have a link to it...

Regards.

--
Alejandro Torras
http://dynamic-interactive.com
_______________________________________________
Mozilla-performance mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-performance