Re: How much faster is Proc{} bind def with 'bind' ?



Chap,

thanks for the feedback and the doc. Understanding this will take
longer.
Meanwhile I have replaced the logical structure in the kernel by
'bitshift'.
Surprisingly this doesn't speed up the algorithm considerably.
This leads again to the question 'which part in the interpreter
workflow consumes most of the time ?'

Best regards --Gernot Hoffmann

---------------------------------------------
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 731 731
%%Creator: Gernot Hoffmann
%%Title: Hilb01
%%CreationDate: November 24/2005

% Draw Hilbert-Peano Curve
% Modified algorithm, originally by Sei-ichiro Kamata, 1996
% Bounding box 258mm

/mm {2.834646 mul} def

0 0 0 1 setcmykcolor
true setstrokeadjust
2 setlinecap

/sx 1 mm def

1 mm 1 mm translate
sx sx scale
0.2 mm sx div setlinewidth

/DrawHilb
{/Tx [0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1] def
/Ty [0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0] def
/Ti [4 0 0 12 0 4 4 8 12 8 8 4 8 12 12 0] def
/g8 0 def
/xo 0 def
/yo 0 def
4
{/x8 Tx g8 get def /y8 Ty g8 get def /g7 Ti g8 get def /g8 g8 1 add def
4
{/x7 Tx g7 get def /y7 Ty g7 get def /g6 Ti g7 get def /g7 g7 1 add def
4
{/x6 Tx g6 get def /y6 Ty g6 get def /g5 Ti g6 get def /g6 g6 1 add def
4
{/x5 Tx g5 get def /y5 Ty g5 get def /g4 Ti g5 get def /g5 g5 1 add def
4
{/x4 Tx g4 get def /y4 Ty g4 get def /g3 Ti g4 get def /g4 g4 1 add def
4
{/x3 Tx g3 get def /y3 Ty g3 get def /g2 Ti g3 get def /g3 g3 1 add def
4
{/x2 Tx g2 get def /y2 Ty g2 get def /g1 Ti g2 get def /g2 g2 1 add def
4
{/x1 Tx g1 get def /y1 Ty g1 get def /g1 g1 1 add def

/xn x1 x2 1 bitshift add x3 2 bitshift add
x4 3 bitshift add x5 4 bitshift add
x6 5 bitshift add x7 6 bitshift add
x8 7 bitshift add def
/yn y1 y2 1 bitshift add y3 2 bitshift add
y4 3 bitshift add y5 4 bitshift add
y6 5 bitshift add y7 6 bitshift add
y8 7 bitshift add def

xo yo moveto xn yn lineto stroke
/xo xn def
/yo yn def

} repeat % 1
} repeat % 2
} repeat % 3
} repeat % 4
} repeat % 5
} repeat % 6
} repeat % 7
} repeat % 8
} bind def

DrawHilb

showpage

-----------------------------------------

.



Relevant Pages

  • Re: How much faster is Proc{} bind def with bind ?
    ... The code in your original posting + patches (DrawHilb0) ran in about ... The code below with partial sums rans in about 700+ ms. ... /g8 0 def ... } repeat % 1 ...
    (comp.lang.postscript)
  • Re: [QUIZ] VCR Program Manager (#101)
    ... thought - oh, can't do lists, no pointers - but then I realized that ... def advance ... new_node.set_next @head ...
    (comp.lang.ruby)
  • Re: is there a better way?
    ... repeat is the number of iteration, ... xcount is the number or non-zero values in the list, ... def with_while: ... res while alist and alist: ...
    (comp.lang.python)
  • Re: is there a better way?
    ... repeat is the number of iteration, ... xcount is the number or non-zero values in the list, ... def with_while: ... return res ...
    (comp.lang.python)
  • How much faster is Proc{} bind def with bind ?
    ... One should think that a procedure with 'bind' is MUCH faster. ... % Draw Hilbert-Peano Curve ... /mm def ... } repeat % 1 ...
    (comp.lang.postscript)

Loading