TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Palindromes (Clojure vs. Common Lisp)

40 pointsby jgrant27over 15 years ago

6 comments

srequeover 15 years ago
He's using vectors with clojure and lists with lisp. Why? It looks like he's concatenating vectors, which is O(n), with clojure, but cons'ing lists, which is O(1), with lisp. As much as I like seeing clojure's performance get critiqued, this comparison doesn't seem fair at all. Why aren't the implementations identical?
评论 #1017419 未加载
评论 #1017745 未加载
scytheover 15 years ago
SBCL is very impressive. Until recently[1], it was far and away the quickest implementation for a dynamic language. Considering we have yet to see invokedynamic or tail calls on the JVM, I'm rather unsurprised by SBCL's comfortable lead in performance.<p>[1] LuaJIT 2
评论 #1017150 未加载
评论 #1016937 未加载
评论 #1016935 未加载
pvgover 15 years ago
It seems easy to hit some implementation wart that makes performance abysmal - it's hard to believe that a JVM targeted language would be 20x times slower. Case in point - I tried the benchmark with a bigger input - the performance ratio between the 'fast' implementations remained the same. Incredibly, though, the CL implementation took nearly 2 minutes to construct the input string, something that is essentially instant in the Clojure version.<p><pre><code> time sbcl --noinform --load palindromes.lisp --eval "(progn (big-test) (quit))" 30000 X ' amanaplanacanalpanama ' fast : Evaluation took: 0.197 seconds of real time 0.191206 seconds of total run time (0.186952 user, 0.004254 system) [ Run times consist of 0.006 seconds GC time, and 0.186 seconds non-GC time. ] 96.95% CPU 471,342,768 processor cycles 13,802,832 bytes consed real 1m55.551s user 1m51.954s sys 0m0.778s</code></pre>
评论 #1017144 未加载
imdover 15 years ago
I don't know much about optimization, but...it looks like he's timing the Clojure version with Clojure already loaded, but timing the SBCL version with SBCL not loaded. Would that change the measurements much?
评论 #1016958 未加载
astineover 15 years ago
Some context might help... which implementation of Common Lisp? SBCL?
评论 #1016847 未加载
rbanffyover 15 years ago
Would the SBCL be able to spread across the many cores a common desktop has today? How is threading implemented in CL?
评论 #1017081 未加载