4 ms·
Really, it flies compared to Ruby...
by gaius 8y ago
Really, it flies compared to Ruby...
- srean 8y agoIs that right ? I have never used Ruby. I should have my expectations on running time in check in case I do try Ruby out -- I have been meaning to.
- gaius 8y agoI don’t dislike Ruby - you can do some very clever things in very little code with it. But it is far from high-performance! Early Tcl was slow - but it was being compared to pure C. Recent Tcl is as snappy as any HLL.
- bch 8y agoEarly (pre-8.0) Tcl was also literally string-processing the scripts. 8.0 brought a byte-compiler and the TclObj internal structure that maintained “native” values for types (I.e: a value “1.2” used as a floating-point value had its value cached as a float/double, versus reconstituting it from the string “1.2” every time it was needed. Note too this conversion happened nearly 20 years ago[0]. These days there’s some excitement surrounding the byte-compiling targeting LLVM[1], so faster still... [0] https://www.tcl.tk/software/tcltk/8.0.html https://www.tcl.tk/software/tcltk/8.0.html [1] https://wiki.tcl.tk/40985 https://wiki.tcl.tk/40985
- petre 8y agoNot really. I did some prime number crunching and it's the slowest of them all. Maybe for simple scripts working with strings, but otherwise I'd pick Lua any day. LuaJIT just runs circles around other dynamic languages, only compiled stuff is able to beat it.
- davidw 8y agoTcl - or Ruby, Python without NumPy (which is an extension) or most scripting languages are not the right tool for the job for number crunching.
- gaius 8y agoRight - both Python and Tcl/Tk are intended to offload heavy processing to C functions that they stitch together with high level controls.
- ptrott2017 8y agoAs DavidW points out Out of the box Tcl (like most scripting languages) was never designed for numeric processing. If you want to do numerics and number crunching in Tcl use one of the extensions such as Vectcl or the Mathemtcl. Tcl's C APi makes writing extensions (or wrapping existing libs) pretty straight forward too.
- blacksqr 8y agoNote that the toplevel link is to a page full of simple techniques for enhancing base Tcl with C, Fortran, Lua etc. code, suggesting that Tcl offers the shortest path from dynamic language to serious number crunching power when it is needed.