Discussion of Common Lisp
-
FAU
Post
by FAU » Thu Mar 03, 2011 1:30 pm
Hey there!
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?
)
-
nuntius
- Posts: 538
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Post
by nuntius » Thu Mar 03, 2011 2:32 pm
Start with COPY-SEQUENCE; it is commonly optimized.
For reading files,
try this.
-
FAU
Post
by FAU » Fri Mar 04, 2011 11:46 am
replace is what I was looking for.
-
Warren Wilkinson
- Posts: 117
- Joined: Tue Aug 10, 2010 11:24 pm
- Location: Calgary, Alberta
-
Contact:
Post
by Warren Wilkinson » Fri Mar 04, 2011 1:33 pm
A word of warning: in my experience, replace can be slower than just concatenating new strings. Use your profiler.