MAP | PageMixer Documents > Design note > Token consuming |
This section explains the reason to
invoke Consumer#consume
method
per each token.
In this document, abbreviated class names are used. Complete names are shown below.
Notation | Full name |
---|---|
Consumer | jp.ne.dti.lares.foozy.pagemixer.mixer.Consumer |
Token | jp.ne.dti.lares.foozy.pagemixer.Token |
Not only one of data but also data in bulk are passed between subjects, if it is well known that large amount of data is processed.
For example, data are passed as the array or the list consists of them, and it reduces costs to invoke methods on each of data.
Once I compared performance between invocation per Token
and one in bulk.
At least at that time,
per Token
invocation was faster than one in bulk,
because creation of intermediate array or list object may cost much.
Creation of object seems to cost much ordinarily.
And it is reason why
Consumer#consume
is designed
to be invoken per Token
.
MAP | PageMixer Documents > Design note > Token consuming |