Home
tinedel
tinedel
........ ....
Back Viewing 0 - 20  

Ужасный киберпространственный имбецил и просто хороший человек предлагает немедленно купить у него картин. Я бы и сам купил, но у меня денег нет.

но точно о какой-то любви:

Ы!!!!

Путник, разгадывать устав загадки бытия
на перекрестке отдохни, как сделал это я
в тени чинары свет дневной ясней
и солнца луч в тиши ночной милей.

http://azbukivedi.livejournal.com/210553.html

http://ivan-da-marya.livejournal.com/499674.html

%hash = map { get_a_key_for($_) => $_ } @array;

is just a funny way to write

%hash = ();
foreach (@array) {
$hash{get_a_key_for($_)} = $_;
}

отсюда

http://neivid.livejournal.com/190589.html

читать немедленно!

Дети, никогда не используйте текстовые значения без констант. От этого бывают неожиданности.

постричься что ли?

Read more... )

(defun fact (n)
  (labels ((fact-rec (n res)
	     (if (= n 0) res
		 (fact-rec (1- n) (* res n)))))
    (fact-rec n 1)))

(defun fact-naive (n)
  (if (= n 0) 1
      (* n (fact-naive (1- n)))))

(defun fact-iter (n)
  (do ((i 1 (1+ i))
       (res 1 (* res i)))
      ((> i n) res)))

(defun compare-facts (n &optional check-naive)
  (gc)
  (if check-naive
      (progn
	(format t "Not tail-optimized~%")
	(time (let ((a (fact-naive n))) 1))))
  (gc)
  (format t "Tail-optimized~%")
  (time (let ((a (fact n))) 1))
  (gc)
  (format t "Iterative~%")
  (time (let ((a (fact-iter n))) 1)))

на 100000 тупая рекурсия сказала что идите вы нафиг я работать не буду
(compare-facts 100000 nil)
Tail-optimized
Evaluation took:
30.774 seconds of real time
30.441903 seconds of total run time (28.905807 user, 1.536096 system)
[ Run times consist of 6.840 seconds GC time, and 23.602 seconds non-GC time. ]
98.92% CPU
49,062,212,525 processor cycles
9,931,233,336 bytes consed
Iterative
Evaluation took:
27.781 seconds of real time
27.581723 seconds of total run time (26.301643 user, 1.280080 system)
[ Run times consist of 6.092 seconds GC time, and 21.490 seconds non-GC time. ]
99.28% CPU
44,306,461,638 processor cycles
9,029,669,120 bytes consed

(compare-facts 10000 t)
Not tail-optimized
Evaluation took:
0.246 seconds of real time
0.228014 seconds of total run time (0.224014 user, 0.004000 system)
[ Run times consist of 0.040 seconds GC time, and 0.189 seconds non-GC time. ]
92.68% CPU
366,546,075 processor cycles
69,580,064 bytes consed
Tail-optimized
Evaluation took:
0.245 seconds of real time
0.232014 seconds of total run time (0.232014 user, 0.000000 system)
[ Run times consist of 0.052 seconds GC time, and 0.181 seconds non-GC time. ]
94.69% CPU
391,160,995 processor cycles
78,592,824 bytes consed
Iterative
Evaluation took:
0.210 seconds of real time
0.200012 seconds of total run time (0.200012 user, 0.000000 system)
[ Run times consist of 0.040 seconds GC time, and 0.161 seconds non-GC time. ]
95.24% CPU
335,864,257 processor cycles
69,587,768 bytes consed

#lang scheme

(define (fact n)
  (let fact ([k n] [res 1])
    (if (zero? k) res
        (fact (sub1 k) (* res k)))))

(define (fact-iter n)
  (do ([i 1 (+ i 1)]
        [res 1 (* res i)])
       ((> i n) res)))

(define (fact-naive n)
  (if (zero? n) 1
      (* n (fact-naive (- n 1)))))

(define (compare-facts n)
  (collect-garbage)
  (time (let ([a (fact-naive n)]) 1))
  (collect-garbage)
  (time (let ([a (fact n)]) 1))
  (collect-garbage)
  (time (let ([a (fact-iter n)]) 1)))


(compare-facts 100000)
cpu time: 92778 real time: 98345 gc time: 13456
cpu time: 87638 real time: 90067 gc time: 11701
cpu time: 79981 real time: 80853 gc time: 10196

Поднял на своем серваке жаббер...
терь он доступен в том числе и через жталк
смело добавляйте tinedel@tinedel.kiev.ua и пишите туда всякое.

Читал вчера всякое по программированию. Набрел на замечательную фразу:
"Perl - хороший язык, но почему-то все программы на нем выглядят так будто кошка уснула на клавиатуре"

И ещё набрел на статью Пола Грэма Хакеры и художники, которая чешет мое ЧСВ, да и вообще он хорошо пишет про всякое.

Ну и да, эпичные срачи на ЛОРе эпичны.

Да, детка!



Не забудьте навести мышку на рисунок. одна из фишечек этого комикса в подписях....

Back Viewing 0 - 20  

Реклама