On 10/1/2013 2:36 PM, Marco Patzer wrote:
On 2013–10–01 Marco Patzer wrote:
Hi,
I wonder if it's necessary to manually load the MetaPost variables
using LoadPageState. Some of them are static and do not require an
update on each page, e.g. NOfPages, but many of them might change on
each page, e.g. OnOddPage, PageNumber, TextWidth.
@Hans: How about adding some more of the dynamic variables to the
MPinitializations in meta-ini.mkiv?
like what
anyway,
\starttext
\startMPcode \stopMPcode
\testfeatureonce{1}{\startMPcode for i=1 upto 1 : LoadPageState ;
endfor ; \stopMPcode}
\testfeatureonce{1}{\startMPcode for i=1 upto 10 : LoadPageState ;
endfor ; \stopMPcode}
\testfeatureonce{1}{\startMPcode for i=1 upto 100 : LoadPageState ;
endfor ; \stopMPcode}
\testfeatureonce{1}{\startMPcode for i=1 upto 1000 : LoadPageState ;
endfor ; \stopMPcode}
\testfeatureonce{1}{\startMPcode for i=1 upto 10000 : LoadPageState ;
endfor ; \stopMPcode}
% LoadPageState defined:
% system > starting feature test
% system > feature test done (0.001s)
% system > starting feature test
% system > feature test done (0.001s)
% system > starting feature test
% system > feature test done (0.002s)
% system > starting feature test
% system > feature test done (0.021s)
% system > starting feature test
% system > feature test done (0.210s)
% Directly set variables
% system > starting feature test
% system > feature test done (0.001s)
% system > starting feature test
% system > feature test done (0.001s)
% system > starting feature test
% system > feature test done (0.000s)
% system > starting feature test
% system > feature test done (0.001s)
% system > starting feature test
% system > feature test done (0.002s)
\stoptext
in mkiv the overhead is less than in mpii as we don't parse the blob in
the same way and the mpiv code is also more optimized so we can consider
dropping the SetPageState macro.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________