saghul / sjs

Skookum JS: a JavaScript runtime
http://sjs.saghul.net
MIT License
97 stars 13 forks source link

Avoid opening /dev/urandom on every call to os.urandom #38

Closed saghul closed 7 years ago

saghul commented 8 years ago

This only applies to systems which actually use /dev/urandom.

The idea is to open the fd once, store it in sjs_vm_t and keep it around. Every time we need to read from it do a fstat and check the inode still matches. (This trick is what CPython does)

saghul commented 7 years ago

Drop this, keeping that fd opened is probably more trouble than it's worth.