Skip to content

andrepiske/rb-arraybuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arraybuffer gem

Tests Gem Version

What?

Ruby lacks classes like array buffer or byte array.

This gem aims to solve that by implementing that natively in C so that a decent performance can be achieved.

The design of the classes follows standards that are implemented in the Web world, like:

The standards above are, however, not strictly followed.

Why?

The only way I found to do this was manipulating an array of numbers treating them as bytes and using buffer.pack('C*') to transform it into a String object. However, for some reason the Array#pack method is painfully slow.

Other gems exist out there, like the class ByteBuffer class in nio4r. However, they didn't had a design I was satisfied with or they had different purposes that wouldn't suit my use case :)

What about JRuby?

Feel free to open a pull request for that!

About

Low level byte operators and buffers for Ruby

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published