These are chat archives for ChaiScript/ChaiScript

28th
Mar 2015
Jason Turner
@lefticus
Mar 28 2015 02:23
Something else must be going on too. I'm suspicious of the missing_member if it's heavily used
Andreas Reischuck
@arBmind
Mar 28 2015 08:49

I doubt that... The current main benchmark loop does not involve any method_missing.

This is the ChaiScript source of the main benchmark part, that is generated by Twofold.

for(var i = 0; i <= 10000; ++i) {
_template.indentPart(" ", 0);
_template.append("Das ist ein kurzer Text! ", 1);
_template.pushPartIndent(2);_template.append((i).to_string(), 2);_template.popPartIndent();
_template.newLine();
_template.pushIndentation(" ", 3);

_template.indentPart("", 4);
_template.append("Line 1 included", 5);
_template.newLine();
_template.indentPart("", 6);
_template.append("Line 2 incldued", 7);
_template.newLine();
_template.popIndentation();
}

_template is registered with all the methods as a class.

Andreas Reischuck
@arBmind
Mar 28 2015 09:20
Executing this code directly as C++ the benchmark completes with 25ms per iteration.
Andreas Reischuck
@arBmind
Mar 28 2015 09:36
It seems the type conversions are a major bottleneck... Changing the API of _template from QString to std::string the time reduces from 1900ms to 1400ms
Keep in mind _template performs the same type conversion internally!
While debugging I have seen, many calls to type conversions even though only one conversion was required. For expensive conversion like this, it results in slowdowns.
Jason Turner
@lefticus
Mar 28 2015 23:22
I'll keep looking into it. It looks like exceptions are no longer showing up in the profiling - so that's at least something.