These are chat archives for ChaiScript/ChaiScript

30th
Apr 2015
Jason Turner
@lefticus
Apr 30 2015 00:29
@/all How long do I need to maintain support for VS2013?? http://t.co/kDIbW4RLmH
Glen Fraser
@totalgee
Apr 30 2015 12:53
Hi there everybody. I've been looking at ChaiScript in the past day or two, and find it really elegant and well-implemented, and very easy to use. One issue (which I know you're aware of) is performance, which is considerably slower than some other "competing" scripting languages. I know @lefticus has said that he wants to do some performance work in 2015.

If anyone is interested (perhaps not ;-) I put a few comparisons into a gist, running the same very basic script (as much as possible) in ChaiScript (develop), SuperCollider (sclang) 3.6.6, Python 2.7 and Lua 5.3:

https://gist.github.com/totalgee/640805cb8995cf588152

Jason Turner
@lefticus
Apr 30 2015 14:06
Build with -DCHAISCRIPT_NO_THREADS and let me know how much of a difference you see
@totalgee AFAIK, chaiscript is the only of those choices that's default thread-safe
Glen Fraser
@totalgee
Apr 30 2015 14:37
Without thread-safety it improved from about 0.49 seconds to 0.33 seconds (about 33% less time).
Jason Turner
@lefticus
Apr 30 2015 14:40
you can also drop the double(i) to just i chaiscript just calls C++ built in operators, so double/int = double
My system (AMD 8 core, Ubuntu 14.04, VM) is running about 2x faster than yours
0.137 seconds
Oh, that's g++4.8. Clang is slower. Clang is more like 0.15s
I'll run your stuff through a performance analysis. I haven't done that in a few weeks. See if anything bubbles up
Jason Turner
@lefticus
Apr 30 2015 15:22

In all honesty, the fact that chaiscript lets you do stuff like:

eval> def `/`(string s, string s2) { "${s}/${s2}" }
eval> "bob" / "tom"
bob/tom

really limits the kind of optimizations we can do, and if you need the fastest scripting language, it will never get there. Particularly with companies like google pouring millions of dollars into javascript optimization. But, if you need some scripting that's easier to use than swig and generates C++ bindings that are at least as fast as SWIGs generated bindings - ChaiScript is already there

Glen Fraser
@totalgee
Apr 30 2015 16:05

I left that one double(i) in my script intentionally, because otherwise the (i * i) in the else case is computed as an int first, and it wraps around for larger i (100000 * 100000 is more than 231) so I get the wrong result sum.

Anyhow, this is not a criticism, I'm delighted to have discovered ChaiScript and I think it's advantages would outweigh any performance hits in many applications... Speed is good...but ease of integration and use are often more important. If I find time, I will also run some profiling and see if there are any low-hanging performance fruits.

Jason Turner
@lefticus
Apr 30 2015 16:34
Ah, OK. Well, I've decided to spend a few minutes today doing some simplifications that I know need to happen. They won't have a big (if any) impact on your code, but they need to get done and might help optimize things more in the future