LINUX.ORG.RU

clojure после common lisp - насколько омерзительно и в чём именно?

 , ,


2

2

Всё ещё думаю о возможности заняться разработкой на clojure. Но ява же тормозная - меня бесит скорость сборки. Вот боюсь, как бы кложа не оказалась слишком уж тормозной.

Расскажите о своих ощущениях (из серии «собираюсь жениться - отговорите»).

★★★★★

Ответ на: комментарий от alienclaster

Нет, cl-cont (defun/cc) -> быстрее в 2,5 раза.

Покажи код list-yield.

snakes почти в 2 раза медленнее, чем defun/cc, то есть все еще быстрее питоньих генераторов на ~20-30%

Вот это и хотел увидеть в прямом сравнении.

А из стандартной библиотеки в 50-80 раз медленнее.

Нет. Из стандартной библиотеки в 6 раз медленнее питоньих генераторов. А в 50-80 раз самопал медленнее, чем версия без генератора.

monk ★★★★★
()
Последнее исправление: monk (всего исправлений: 1)
Ответ на: комментарий от monk

Покажи код list-yield.

А выше там был:

(cl-cont:defun/cc list-cc (n) (loop for i from 1 to n collect i))
(time (dotimes (k 10000) (list-cc k) nil))

;; => 7.706 sec

(defun list-snakes (n) (generator->list (with-yield (dotimes (i n)(yield i)))))
(time (dotimes (k 10000) (list-snakes k) nil))

;;=> 12.798 sec

(defun list-n (n) (loop for i from 1 to n collect i))
(time (dotimes (k 10000) (list-n k) nil))

;; => 0.477 sec

Нет. Из стандартной библиотеки в 6 раз медленнее питоньих генераторов. А в 50-80 раз самопал медленнее, чем версия без генератора.

Ok, я понял как-то наоборот. У себя еще чекнуть попробую чуть позже.

alienclaster ★★★
()
Ответ на: комментарий от alienclaster

(cl-cont:defun/cc list-cc (n) (loop for i from 1 to n collect i))

Так тут нет yield. Тут простое создание списка. Тормоза только за счёт возможности сохранить продолжение.

(defun list-snakes (n) (generator->list (with-yield (dotimes (i n)(yield i)))))

Здесь согласен. Это эквивалент. 13 секунд с safety 0 или нормальными настройками (safety 2) (speed 3)?

monk ★★★★★
()
Ответ на: комментарий от alienclaster

У Common Lisp’овой версии только одна проблема: внешние функции, скомпилированные без cl-cont не позволяют вернуть продолжение. То есть

(defun list-snakes (n) 
  (generator->list 
    (with-yield 
      (mapс (lambda (i) (yield i))
            (loop for k from 1 to n collect k)))

работать не будет, если map не создана через defun/cc. А если создан через defun/cc, то будет тормозить во всех остальных местах

monk ★★★★★
()
7 февраля 2022 г.

You have been given this inheritance. A class is a tool for structuring code and setting custom types. Inheritance is just one of the features, and with duck typing it’s not really needed. Although I do not see anything wrong with the careful use of inheritance within the framework of the internal kitchen. Here is the inheritance from a third-party class, as the frameworks love, this is trash and sodomy. But these are problems of the user, not the tool. Of course, I understand the motivation of the authors of Go: unscrew all the knobs and weld the buttons so that the monkeys sit quietly in their capsule and do not rock the boat.[url=http://mobisoftinfotech.com/services/cloud-development-services]Cloud development services[/url] But I think they will eventually bend before the frog and add classes.

adamsmith104064
()

Two cups of tea for this gentleman. I would explain the phenomenon as follows (you can already switch to lisposrach because the issue’s content has been resolved, so I insert a horizontal line into the message to separate parts of the discussion from each other) - in any sect, part of the postulates should be purposefully absurd. Do you recall the storey about Vila? The cult was founded on deception, allowing for rapid desacralization and declericalization.Cloud development services Those in the cult must have an NSA bookmark that can be used to turn it off. The tale of Prince Gleb and the Magus is from the same series.

adamsmith104064
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.