Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Even faster flexbox #123

Merged
merged 3 commits into from
Sep 15, 2015
Merged

Even faster flexbox #123

merged 3 commits into from
Sep 15, 2015

Conversation

lucasr
Copy link
Contributor

@lucasr lucasr commented Sep 14, 2015

This branch has a series of changes on top #121 and #122 that makes css-layout an extra 50% faster in my benchmarks on Android.

It does two things:

  • Aggressively inline private methods at build time in Java (~30% perf win)
  • Optimize spacing lookup at layout time (~20% perf win)

Unfortunately, Java doesn't have any build-time inlining solution and
method invocations do have a big performance impact on Android. This
changes Java's transpiler to inline almost all internal methods at build
time. This gives us a 30% performance win in my local benchmarks.

There's a drawback from moving code to the transpiler but I think this
is worth it (given the massive perf wins here) and the inlined methods
are fairly simple.
It turns the spacing resolution in Java is fairly expensive right now
because it doesn't a bunch of unnecessary checks in the array,
especially when the Spacing instance doesn't have any values set on it.

This diff changes Spacing to store the state of the defined values in a
bitwise flag so that padding/border/margin queries are a lot faster
during layout calculations. This gives us as extra 20% performance win
in my local benchmarks on Android
aaronechiu added a commit that referenced this pull request Sep 15, 2015
@aaronechiu aaronechiu merged commit f51c2d0 into facebook:master Sep 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants