Discussion of Common Lisp
What is the most efficient way to copy the content of s into d?
Is there an equivalent to C's memcpy?
Code: Select all
(let ((s "hello world")
(d (make-string 50)))
;; What is the most efficient way to copy the content of s into d?
;; Is there an equivalent to C's memcpy?
- Posts: 538
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Start with COPY-SEQUENCE; it is commonly optimized.
For reading files, try this
replace is what I was looking for.
- Posts: 117
- Joined: Tue Aug 10, 2010 11:24 pm
- Location: Calgary, Alberta
A word of warning: in my experience, replace can be slower than just concatenating new strings. Use your profiler.