]> source.dussan.org Git - vaadin-framework.git/commit
Improve performance of getMeasureTargetsJsArray (#16973).
authorFabian Lange <lange.fabian@gmail.com>
Mon, 2 Mar 2015 12:28:15 +0000 (13:28 +0100)
committerLeif Åstrand <leif@vaadin.com>
Wed, 11 Mar 2015 10:47:43 +0000 (12:47 +0200)
commitc3fb52c0b1c467b5c38ed0e3590bf6c23ee1db9c
tree4d27c48175f477d79c22a3ff824743c7640ce84f
parent91505f27fbd9a46d40df3ca0851cb2074ed66f96
Improve performance of getMeasureTargetsJsArray (#16973).

This change optimizes the method
LayoutDependenyTree.getMeasureTargetsJsArray.

The previous code dumps both MeasureQueues and then iterates over the
vertical one and then checks if it is present in the horizontal one.
If it is not present it pushes the element to the array (which usually
invokes an arraycopy in js).

The new code adds both Queues to a new FastStringSet which does deal
with duplicates nicely.
While this is not much faster than the dumps, it avoids the array
allocations and the separate iteration for duplicate checking.

Change-Id: I2f643a2d0b32e4c2517efff16c196387f38f0d8a
client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java