The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.
You have already mentioned in various posts that you like
to create functions with Nodebox only on-board tools.
The question arose in my mind: why are you trying to do some
things explicitly in Nodebox? Is this performance related?
Does this function work faster?
To what extent do the speeds of a function that works using a node
with a Python script and one that only works with nodebox means differ?
Or are there any other reasons?
gottfried
JO
JOjohn
Gottfried,
Good question.
Actually, external modules written in Python or Clojure are typically faster - often much faster - than pure Nodebox code.
In theory, Nodebox could be very fast for some tasks because it would make it easy for a compiler to divide the computation into multiple threads and do some of the work in parallel. It's also a pure and relatively simple functional language. But it was not written for speed; it was written to maximize interaction and promote play. It's no slouch, and can sort 100,000 strings in the blink of an eye, but by modern standards is relatively slow.
There is no reason not to use external modules; it can be an interesting challenge and can open up exciting new capabilities for Nodebox. Indeed, that's why I do include about a dozen such modules in my library.
I have two reasons, however, for preferring to code purely in NodeBox
As I mentioned in my other note, I like the challenge. In some ways coding in Nodebox is like doing martial arts blindfolded: no loops, no branches, no recursion, no pixels, etc. Yet, with determination, it's possible to do just about anything. From that point of view, resorting to an external module feels a bit like cheating.
External modules are a slight pain to set up and maintain. The best practice is to quit Nodebox, create a folder, move your ndbx file inside, make a copy of the module you need from my library (or roll your own) and transfer that inside the folder, then relaunch Nodebox and add the module to your code library. If you then distribute your project, you should zip the entire folder so that the ndbx file and the module do not become separated. If you fail to do this, the NodeBox file will refuse to open and you have to edit the text file to get it to work. Not a huge deal, but a nuisance.
Hope that helps.
John
LA
LAlastvector
John
Thank you very much for your comprehensive explanation.
It's definitely helpful to know something about the differences
between the two ways.
gottfried
Know something that helps?
Sign in with your email address to reply. No password needed.