Bert.js - Binary ERlang Term serialization library for Javascript (with Elixir support)

@5HT Your username is like CRAZY familiar… what do you do? Did you write nitrogen or it’s n2o fork or something?

Hello, OvermindDL1! The original Nitrogen author (as you may already know) is Rusty Klophaus, we picked up nitrogen_core in late 2013 and forked it to the N2O project which is one of carefully selected, frozen and adopted erlang packages n2o.space. Since original n2o announcement at HN, we added support of MQTT and did 21 releases of n2o.

2 Likes

Very cool!

Question time: When is it useful to use Bert.js instead of JSON? (Because while BERT/ETF is Elixir’s ‘native’ serialization, JSON is the browser’s native serialization, so I’m not sure about the advantages of using BERT here.) How does its JS (de)serialization compare in sense of execution speed/memory usage vs JSON?

1 Like

I think the logic is that the server is a more limited resource, so having a fasted serialization library there becomes more important. Although I haven’t had any problems with encoding speed of json in my own apps yet.

1 Like

I would say that using BSON, MessagePack, bert.js, JSON alone without generators is a naїve approach. The more mature approach is to use parser generators, like ASN.1, protobuf, synrc/bert. The latter one provides gRPC/protobuf, JavaScript, and Swift SDK generation from HRL files. But even in the naїve case, bert.js provides type hints immediately after DataView unpack. Also, that (type hints) are useful for client-side validation, and for sure in that way we remove unnecessary abstraction layer at the server side. Harder, Better, Faster, Stronger!

3 Likes