hotmem

Hot memory access library for Haxe
https://github.com/eliasku/hotmem

To install, run:

haxelib install hotmem 0.0.2 

See using Haxelib in Haxelib documentation for more information.

README.md

hotmem

Build Status Build status

Lang Version Dependencies License

Hot memory access for Haxe

Targets

TargetArraysHot ViewBytes ViewImplementation
cpp+++hxcpp_memory / pointer
flash+++Memory Domain
js+++Parallel Typed Arrays
nodejs+++Parallel Typed Arrays*
cs+--NativeArray
java+--NativeArray

Define -D hotmem_debug enabling bounds checking, traces and additional asserts

Usage

Create your static dense fixed-length typed arrays before performance critical operations.

Use HotView if different value-type access required

Types

  • hotmem.U8: 8-bit unsigned int
  • hotmem.U16: 16-bit unsigned int
  • hotmem.I32: 32-bit signed int
  • hotmem.F32: 32-bit floating-point

Typed Arrays

For each types continuous memory fixed-length array is available (buffer)

  • hotmem.U8Array: 8-bit unsigned int array
  • hotmem.U16Array: 16-bit unsigned int array
  • hotmem.I32Array: 32-bit signed int array
  • hotmem.F32Array: 32-bit floating-point array

Hot View

Each array could be wrapped for memory read/write operations:

var view = array.view(?atElement);
view.setU8(bytePosition, value);
view.setU16(bytePosition, value);
view.setI32(bytePosition, value);
view.setF32(bytePosition, value);

value = view.getU8(bytePosition);
value = view.getU16(bytePosition);
value = view.getI32(bytePosition);
value = view.getF32(bytePosition);

Data View

As Hot-View you able to lock any haxe.io.BytesData:

Modify templates and generate the code

$hotmem> haxelib run hxmake generate

TODO:

  • More tests
  • NodeJS implementation
  • Types: I8, I16, U32, F64
  • Java / CS implementation for hot/bytes view
  • General fallback for other dynamic targets (macro as well)
  • More documentation on BytesView / lock / unlock flow
  • Dox documentation
Contributors
eliasku
Version
0.0.2
Published
1 year ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github