Skip to content

andrestubbe/FastGrid

Repository files navigation

FastGrid v0.1.0 [ALPHA] — Ultra-Fast Zero-Allocation Layout Engine

Status License: MIT Java Platform JitPack


⚡ High-performance multi-item layout engine for the FastJava ecosystem.

FastGrid provides pure math pipelines for computing Grid, Masonry, and Gallery layouts. It operates entirely on float[] arrays to achieve true zero-allocation during layout passes, completely eliminating Garbage Collection stutter during high-FPS animations and window resizing. Watch the Demo

FastGrid Showcase


Zero-Allocation Architecture

Standard layout engines (like AWT LayoutManagers, JavaFX, or Swing) instantiate objects (like Rectangle, Cell, Bounds) for every item during every layout pass. When calculating dynamic layouts at 60+ FPS, this creates immense garbage collection pressure.

FastGrid takes a different approach:

  • No Objects: It reads from a flat input array of aspect ratios and writes to a pre-allocated flat float[] output array.
  • Pure Math: Decoupled from rendering APIs. It computes the math and returns the raw coordinates [x1, y1, w1, h1, x2, y2, w2, h2, ...].
  • Cache Locality: By packing everything tightly into primitive arrays, it achieves insane throughput by leveraging CPU cache lines.

Installation (JitPack)

<dependency>
    <groupId>com.github.andrestubbe</groupId>
    <artifactId>fastgrid</artifactId>
    <version>v0.1.0</version>
</dependency>

Part of the FastJava EcosystemMaking the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

High-performance, zero-allocation multi-item layout engine for Java (Grid, Masonry, Gallery). Part of the FastJava Ecosystem.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors