Functions via Python scripts vs Nodbox only Tools
Hi John
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
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by john on 28 May, 2024 07:21 PM
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
Hope that helps.
John
2 Posted by lastvector on 28 May, 2024 07:37 PM
John
Thank you very much for your comprehensive explanation.
It's definitely helpful to know something about the differences
between the two ways.
gottfried