Skip to content

RichardWarburton/slab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slab

There is a good description here

tl;dr: Offheap Java Tuples that look like POJOs with guaranteed memory alignment.

Code Example

// Define your DataType
public interface GameEvent extends Cursor {
  public int getId();
  public void setId(int value);
  public long getStrength();
  public void setStrength(long value);
}

// Create an allocator for your DataType
Allocator<GameEvent> eventAllocator = Allocator.of(GameEvent.class);

// Allocate 100 off heap GameEvent instances - sequentially in memory
GameEvent event = eventAllocator.allocate(100);

// Move to the index of the instance that you want to read from or write to
event.move(1);

// set and get values like a normal POJO
event.setId(6);
assertEquals(6, event.getId());

About

Offheap Java POJOs with guaranteed memory alignment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages