Functions via Python scripts vs Nodbox only Tools

lastvector's Avatar


28 May, 2024 12:01 PM

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?

  1. Support Staff 1 Posted by john on 28 May, 2024 07:21 PM

    john's Avatar


    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.


  2. 2 Posted by lastvector on 28 May, 2024 07:37 PM

    lastvector's Avatar


    Thank you very much for your comprehensive explanation.
    It's definitely helpful to know something about the differences
    between the two ways.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? 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

Recent Discussions

23 Jul, 2024 04:46 PM
22 Jul, 2024 07:50 AM
11 Jul, 2024 03:48 PM
28 Jun, 2024 01:51 PM
27 Jun, 2024 02:56 PM


27 Jun, 2024 01:57 PM
26 Jun, 2024 08:17 PM
26 Jun, 2024 11:35 AM
24 Jun, 2024 02:42 AM
24 Jun, 2024 12:46 AM
23 Jun, 2024 08:07 AM