[luatex] Copy or recreate nodes.

Paul Isambert zappathustra at free.fr
Fri Aug 6 20:02:19 CEST 2010

Hello all,

It's a bit calm here today, so let's ask a somewhat Byzantine question so we (at
least I) will be a little more knowledgeable tonight.

Suppose I want to add a node in a list. The question is, what's the preferred
solution between the following two:

1. Create one node and copy it:
  mynode = node.create(10) % Let's say it's a glue.
  % Some node specs here
  function addnode (head,place)

2. Create a new node each time:
  function addnode(head,place)
    local mynode = node.create(10)
    % Some node specs here

Both approaches work, but: is one better/faster/more economical than the other?
Is the difference significant anyway?

My guess is that the first method is better if for instance you add a few nodes
many times, and the second one is better if you add many nodes a few times each.
(Overall I find the first one looks better.)


More information about the luatex mailing list