Ai
1 Star 0 Fork 0

烟波/cl-gserver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
queues-bench.lisp 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
Manfred Bergmann 提交于 2024-02-15 04:41 +08:00 . queue CAS WIP.
(eval-when (:compile-toplevel)
(ql:quickload '(:lparallel :jpl-queues :sento)))
(defstruct queue-obj a b c)
(defparameter *sync-unbounded-queue*
(make-instance 'jpl-queues:synchronized-queue
:queue
(make-instance 'jpl-queues:unbounded-fifo-queue)))
(defparameter *sync-bounded-queue*
(make-instance 'jpl-queues:synchronized-queue
:queue
(make-instance 'jpl-queues:bounded-fifo-queue
:capacity 1000000)))
(defun queue-and-dequeue-jpl (queue)
(loop :repeat 1000000
:do
(progn
(jpl-queues:enqueue
(make-queue-obj :a 1 :b 2 :c 3)
queue)
(jpl-queues:dequeue queue))))
(defparameter *sento-unbounded-queue*
(make-instance 'queue:queue-unbounded))
(defparameter *speedy-queue*
(make-instance 'queue:queue-bounded :max-items 2000000))
(defun queue-and-dequeue-sento (queue)
(loop :repeat 1000000
:do
(progn
(queue:pushq
queue
(make-queue-obj :a 1 :b 2 :c 3))
(queue:popq queue))))
(defparameter *cons-queue* (lparallel.cons-queue:make-cons-queue))
(defun queue-and-dequeue-cq (queue)
(loop :repeat 1000000
:do
(progn
(lparallel.cons-queue:push-cons-queue
(make-queue-obj :a 1 :b 2 :c 3)
queue)
(lparallel.cons-queue:pop-cons-queue queue))))
(defun run-tests ()
(format t "jpl-unbounded:~%")
(time (queue-and-dequeue-jpl *sync-unbounded-queue*))
(format t "jpl-bounded:~%")
(time (queue-and-dequeue-jpl *sync-bounded-queue*))
(format t "mabe sento-unbounded queue:~%")
(time (queue-and-dequeue-sento *sento-unbounded-queue*))
(format t "mabe speedy-queue:~%")
(time (queue-and-dequeue-sento *speedy-queue*))
(format t "cons-queue unbounded:~%")
(time (queue-and-dequeue-cq *cons-queue*)))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Common Lisp
1
https://gitee.com/macro/cl-gserver.git
git@gitee.com:macro/cl-gserver.git
macro
cl-gserver
cl-gserver
master

搜索帮助