154 days ago · Tech · hide · Fediverse post

I saw that there was some argument over how much slower slot access is than struct access, so I just decided to measure it naively. I made a two slot sruct and a CLOS version of a CONS cell with car and cdr slots and I ran LTAK using regular lists, `lists' made from CLOS conses, and `lists' made from structs. Here are the results: D:\repositories\clos-benchmark>sbcl --script run-benchmarks.lisp Benchmark: ltak over native cons cells, CLOS my-cons nodes, and my-cons-struct nodes Inputs: x=15 y=9 z=4 repeats=35 Scenario min-ms mean-ms max-ms ratio -------------------------------------------------------------------- native standard 0.129 0.146 0.186 clos standard 1.346 1.365 1.475 9.37x struct standard 0.172 0.175 0.179 1.20x native optimized 0.068 0.069 0.073 clos optimized 0.411 0.414 0.419 6.04x struct optimized 0.068 0.069 0.073 1.01x In this naive use case, structs are same as native cons cells, but CLOS objects are one ninth the speed of a struct or cons cell if you just use it…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town