These are chat archives for ChaiScript/ChaiScript

19th
Mar 2018
Tharindu Mathew
@mackiem
Mar 19 2018 21:03
@lefticus I just got some cycles to recompile chaiscript with thread support. Performance improve is at least 10x on VS 2013. It is mind blowing. I do use multi threading but I create my own instance of chai for each (maybe not the best way, but this is only for a non interactive optimization use case, so doesn't matte if it hogs memory and cpu). Making it thread safe by design.
without thread support*
I would encourage you to release without thread support, just for the perf gains
Jason Turner
@lefticus
Mar 19 2018 21:21
@mackiem I don't think I'll ever make thread-unsafe the default, it's a very easy compile time option. Been there almost since the very beginning nearly 10 years ago now
but I'm glad it worked out well for you
on my systems, with my performance tests, it's only about a 20% performance difference (mostly on Linux)
Tharindu Mathew
@mackiem
Mar 19 2018 21:23
so is it just compile time option? I had to recompile chaiscript to get libs and dlls.
stdlib
Jason Turner
@lefticus
Mar 19 2018 21:25
Does that mean you are using the precompiled version of ChaiScript? I rarely recommend that, since it's just a header file to include
you just have to set CHAISCRIPT_NO_THREADS
Tharindu Mathew
@mackiem
Mar 19 2018 21:26
Ok, I can't remember as to why I went along this path. Is 5.8.6 header only with visual studio?
2013
Jason Turner
@lefticus
Mar 19 2018 21:28
Yes, it's been header only since it was first created
you can compile the stdlib separately, but you certainly don't have to
This version is out of date for 6.0.0, but correct for 5.8.6 https://gist.github.com/lefticus/9456197#file-chaiscript_compiled_in_stdlib-cpp
Tharindu Mathew
@mackiem
Mar 19 2018 21:31
Ok, cool I will try it out
So, you claim that this will be even faster with VS 2017. This is very tempting. I have a bunch of legacy code I need to clean up, but I probably will give that a try.
Jason Turner
@lefticus
Mar 19 2018 21:42
Yes, not my claim, claim from the VS team
each version of VS is faster than the last version. if you move to VS2015 then also upgrade to chaiscript 6, as that is significantly faster also
Tharindu Mathew
@mackiem
Mar 19 2018 21:45
but native code will be faster? That's not surely possible.
Jason Turner
@lefticus
Mar 19 2018 21:50
Why not? Optimizers are always getting better with every new compiler release
plus the C++ standard library is getting more and more optimized with each new compiler release
Tharindu Mathew
@mackiem
Mar 19 2018 21:52
so can we optimize our way to 8K output? :)
Jason Turner
@lefticus
Mar 19 2018 21:52
Well... there's probably some limit, but we aren't there yet
Tharindu Mathew
@mackiem
Mar 19 2018 21:53
Like I can understand something move operaitons being optimized or tail recursion being optimized. But, there's always a limit if you try to make your code as simple as possible
Jason Turner
@lefticus
Mar 19 2018 21:53
You're mostly correct, but thinking too low level
The compilers are able to better order operations and use better CPU instructions also
better ordering means better throughput
Tharindu Mathew
@mackiem
Mar 19 2018 21:54
right, as a CS person, we learn that order matters a lot
Jason Turner
@lefticus
Mar 19 2018 21:54
The trivial examples we all like to show on Compiler Explorer are still trivial. Once a program reaches non-trivial size the complexities are much too hard for us to reason about generally speaking
Tharindu Mathew
@mackiem
Mar 19 2018 21:55
hmmm, very interesting
so it's a never ending source of research I guess
Jason Turner
@lefticus
Mar 19 2018 21:56
It is. Plus also I know something as simple as std::string is something like 3x faster from MSVC 2013 to MSVC 2017
Tharindu Mathew
@mackiem
Mar 19 2018 21:58
really? wonder for what operations
seems to be across the board, that is what the results were for a JSON parser
I'm sure billy would answer questions on twitter if you asked
Tharindu Mathew
@mackiem
Mar 19 2018 22:00
I wonder whether we can find ways to squeeze more perf out of gfx cards as well