realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.75k stars 568 forks source link

Graal.js support #2756

Open l7x opened 4 years ago

l7x commented 4 years ago

Are there any plans to officially support Graal.js node runtime? Most native node.js addons already work perfectly on Graal, but I guess with something as complex as Realm, a lot can go wrong at this point.

The benefit of GraalVM is that (in theory) it can eliminate the expensive overhead of JS/C++ boundary calls, which can kill performance of apps which require a lot of calls through the boundary (almost every access of Realm collection entries or Realm object properties is a cross-boundary call). UPDATE: it seems that Graal.js node extensions are not optimized at this point

bmunkholm commented 4 years ago

The short answer is no. I'm also not aware that anyone has tried to see if it works or what it would take to make it work.

l7x commented 4 years ago

OK, if someone decides to give it a try, can we report the problems here, or are we totally on our own with such setup?

bmunkholm commented 4 years ago

It would be awesome if you could try it out and report here. We can't promise much support on this though as it's not a feature we are prioritizing. But do post questions / issues, as the community might be interesting in helping out.

l7x commented 4 years ago

This went much better than I expected. I used the latest Community Edition of GraalVM (20.0.0) on Linux. First I tried with Realm v3.6.5 - of course, that didn't work because it doesn't support Node 12 Then v4.0.0-beta.2 - failed to compile Then I saw that v5.0.0 was released a few hours ago - it did compile without any problems and it seems to work. There are some bugs - i.e. I can't use console.log on objects/collections and I get "Segmentation fault" when I try to do realm.close(); but I get the same things with my regular node installation with 5.0.0.

I need to play more with this, I did only some very basic testing and so far it seems very promising. I'll post here when I'll have more info.

kraenhansen commented 4 years ago

I can't use console.log on objects/collections

Why is that, what is your experience?

There are some bugs - i.e. I can't use console.log on objects/collections and I get "Segmentation fault" when I try to do realm.close(); but I get the same things with my regular node installation with 5.0.0.

We would highly appreciate if you filed an issue with details on getting this segmentation fault calling realm.close() via a regular Node.js. I've tried, but I cannot reproduce this.

l7x commented 4 years ago

I can't use console.log on objects/collections

Why is that, what is your experience?

You described the gist of it in https://github.com/realm/realm-js/issues/2758 One interesting thing here is that on regular node (10), I get something like this for collections: Results { '0': undefined, '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined }

On Graal node (12), results always look empty, no matter how many elements are in the collection: Results {}

I'm not sure if that's the difference between Graal and regular node or just node 10 vs 12.

There are some bugs - i.e. I can't use console.log on objects/collections and I get "Segmentation fault" when I try to do realm.close(); but I get the same things with my regular node installation with 5.0.0.

We would highly appreciate if you filed an issue with details on getting this segmentation fault calling realm.close() via a regular Node.js. I've tried, but I cannot reproduce this.

OK, I'll file a new issue with more details regarding that.

joaodematejr commented 4 years ago

Não consigo usar o console.log em objetos / coleções

Por que é isso, qual é a sua experiência?

Você descreveu a essência disso no # 2758 Uma coisa interessante aqui é que no nó regular (10), recebo algo assim para coleções: Results { '0': undefined, '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined }

No nó Graal (12), os resultados sempre parecem vazios, não importa quantos elementos estejam na coleção: Results {}

Não tenho certeza se essa é a diferença entre o Graal e o nó regular ou apenas o nó 10 vs 12.

Existem alguns erros - ou seja, não posso usar console.log em objetos / coleções e recebo "Falha de segmentação" quando tento fazer realm.close (); mas recebo o mesmo com minha instalação regular do nó com 5.0.0.

Agradecemos se você registrou um problema com detalhes sobre como obter essa falha de segmentação chamando realm.close () por meio de um Node.js. regular Eu tentei, mas não posso reproduzir isso.

OK, vou registrar um novo problema com mais detalhes sobre isso.

same problem with react-native - Android

kneth commented 4 years ago

Graal.js support is not on the radar at the moment but I will leave the issue open as a future enhancement.