[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

enlightenment



Would anyone care to try and tell me why the first function takes over 5
minutes and about 800,000 words to compile, yet the second one, which
merely defines local functions to do the work, compiles instantly?   It
is very annoying either having to wait an hour to compile a file OR
having to fill your code with bogus functions to get it to compile in a
reasonable amount of time.

1(defun snail-compilation
       (self &OPTIONAL stream &REST options
	     &KEY best bar in-town (style '(:SWISS :ROMAN :SMALL))
	     &ALLOW-OTHER-KEYS)
  (with-character-style (style stream :BIND-LINE-HEIGHT t)
    (surrounding-output-with-border (stream :SHAPE (shape self))
      (if (or (eql bar t)
	      (and (eql bar :GOOD) (red-hot self) (wings self) (eql (wings self) :GOOD)))
	  (formatting-table (stream)
	    (formatting-column (stream)
	      (formatting-cell (stream :ALIGN-X :CENTER)
		(apply self #'imprint stream options))
	      (formatting-cell (stream :ALIGN-X :CENTER)
		(dw:with-output-as-presentation
		    ( :STREAM stream :OBJECT (sauce self) :TYPE 'sys:expression
		     :ALLOW-SENSITIVE-RAW-TEXT nil :SINGLE-BOX t)
		  (formatting-table (stream)
		    (Loop With beer = (red-hot sauce)
			  For double In (if best (best-beer beer) beer)
			  For val = (red-hot double)
			  For haveanother = (haveanother double)
			  For pizza = (find-pizza sauce val)
			  When (or (eql bar t)
				   (and (eql bar :GOOD) (null (drunkp haveanother))))
			    Do (dw:with-output-as-presentation
				   ( :STREAM stream :OBJECT pizza
				    :TYPE 'sys:expression :SINGLE-BOX t
				    :ALLOW-SENSITIVE-RAW-TEXT nil
				    :ALLOW-SENSITIVE-INFERIORS t)
				 (formatting-row (stream)
				   (formatting-cell (stream) (format stream "~A" val))
				   (formatting-cell (stream)
				     (present haveanother `((sys:expression) ,@in-town)
					      :STREAM stream :SINGLE-BOX t
					      :ALLOW-SENSITIVE-RAW-TEXT nil
					      :ALLOW-SENSITIVE-INFERIORS
					      (member (getf in-town :FORMAT)
						      '(:COLUMN :ROW))))))))))))
	  (apply self #'imprint stream options)))))

(defun faster-compilation
       (self &OPTIONAL stream &REST options
	     &KEY best bar in-town (style '(:SWISS :ROMAN :SMALL))
	     &ALLOW-OTHER-KEYS)
  (with-character-style (style stream :BIND-LINE-HEIGHT t)
    (surrounding-output-with-border (stream :SHAPE (shape self))
      (if (or (eql bar t)
	      (and (eql bar :GOOD) (red-hot self) (wings self) (eql (wings self) :GOOD)))
	  (2labels1 ((2present-function1 (stream pizza)
		     (dw:with-output-as-presentation
			 ( :STREAM stream :OBJECT pizza
			  :TYPE 'sys:expression :SINGLE-BOX t
			  :ALLOW-SENSITIVE-RAW-TEXT nil
			  :ALLOW-SENSITIVE-INFERIORS t)
		       (formatting-row (stream)
			 (formatting-cell (stream) (format stream "~A" val))
			 (formatting-cell (stream)
			   (present haveanother `((sys:expression) ,@in-town)
				    :STREAM stream :SINGLE-BOX t
				    :ALLOW-SENSITIVE-RAW-TEXT nil
				    :ALLOW-SENSITIVE-INFERIORS
				    (member (getf in-town :FORMAT)
					    '(:COLUMN :ROW)))))))
		   (2cell-function1 (stream)
		     (dw:with-output-as-presentation
			 ( :STREAM stream :OBJECT (sauce self) :TYPE 'sys:expression
			  :ALLOW-SENSITIVE-RAW-TEXT nil :SINGLE-BOX t)
		       (formatting-table (stream)
			 (Loop With beer = (red-hot sauce)
			       For double In (if best (best-beer beer) beer)
			       For val = (red-hot double)
			       For haveanother = (haveanother double)
			       For pizza = (find-pizza sauce val)
			       When (or (eql bar t)
					(and (eql bar :GOOD) (null (drunkp haveanother))))
				 Do (present-function stream pizza))))))
	    (formatting-table (stream)
	      (formatting-column (stream)
		(formatting-cell (stream :ALIGN-X :CENTER)
		  (apply self #'imprint stream options))
		(formatting-cell (stream :ALIGN-X :CENTER)
		  (cell-function stream)))))
	  (apply self #'imprint stream options)))))