At Mon, 6 Apr 2015 00:37:51 -0700 (PDT), Lux wrote: > > It is more efficient (second myList) or (car (cdr myList)) if it is > any difference at all?
I second what Matthias said. > What are the principles I can keep in mind when I try to make code as > efficient as possible? You may be interested in the performance chapter of the guide: http://docs.racket-lang.org/guide/performance.html > Some basic functions are implemented in C in the language. They are > necessarily more fast to simple abstractions/helpers (in Racket) based > on them that can be reimplemented easily without requiring libraries > like racket/list in addition lo save memory and load times? You'd be surprised. The Racket byte-compiler and JIT are pretty good. We've been porting some primitives from C to Racket and observed some speedups. It helps that Racket functions can be inlined (and then optimized further), whereas C primitives cannot. > I know readable code is generally better, but how can I save some > fractions of seconds here and there changing my constructs? Racket has performance tools that can help you diagnose performance issues, and focus your treatment efforts. Profiler: http://docs.racket-lang.org/profile/index.html Feature-specific profiler: http://pkg-build.racket-lang.org/doc/feature-profile/index.html Optimization coach: http://pkg-build.racket-lang.org/doc/optimization-coach/index.html It's better to write readable code first, then find out which parts are too slow and why, then optimizse those only. Vincent -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.