-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please have a new run! #10
Comments
I will probably update all code bases & give it a new run this summer. I'm busy until then! :/ |
I am also looking forward to the new results. |
I recommend using gcc (MinGW for windows) to compile angelscript. Because the standard string add-on of angelscript use std::string by default. And the performance of MSVC std::string is low (just allocate and copy, no reference counting and copy-on-write support. It's a big hurt for something like a benchmark). I guess in most serious real cases where performance is a matter, almost all programmers will implement them own string type by hand. For example, we can even eliminate the memory allocation and memory copy overhead of the String Factory by using the static data semantic (see: https://www.gamedev.net/topic/685672-is-it-safe-to-use-the-char-argument-of-string-factory-as-static-data/). So in real case the performance can be further improved. The purpose of the test is to reflect the true level of the engine, So I think it is necessary to adjust the engine to its real world status. |
Also, I suspect that register a line callback could dramatically slow down the engine. Use another timer thread which call ctx->Abort() on timeout instead. |
I feel like there is a way this project can be architected such that these tests run on a VM and can be contributed by and perhaps even run by the community. It would be work up front, but in the long run would both mitigate a lot of work that @r-lyeh has to do, and let us keep it updated. Maybe we should brainstorm about ways to do that that aren't too difficult. |
@rosshadden Like continuos integration? Whenever a library or test case is changed then run it again. |
Yeah. |
Probably Off Topic: @asbai AFAIK, MinGW/GCC don't use reference counting and copy-on-write design for std::string. What they're using is a small-buffer optimization. Meaning, if your string is less than 16 characters, then it'll be stored in a local buffer and no heap allocation is performed. This makes the string type size be 8 bytes bigger than it would normally be and require some extra work (like when doing move semantics). But it pays off in the end because you avoid heap allocation for small strings and you never have to check for null buffer because there's always a buffer present. Also, why only 8 extra bytes when the local buffer is 16 bytes? (on 64 bit at least) It uses a union for the local buffer and capacity since the capacity is always known for the local buffer. Kinda like: struct String {
static constexpr size_t MINCAP = 16;
char * m_Buffer;
size_t m_Occupied;
union {
char m_LocalBuffer[MINCAP];
size_t m_Capacity;
};
String() noexcept
: m_Buffer(m_LocalBuffer), m_Occupied(0)
{
m_LocalBuffer[0] = '\0';
}
}; If you're so hell bent on avoiding string copies where not necessary. I'd suggest investing some time in studying string/array views. Which were even added in the next C++17 standard. |
Good ideas overall.
|
@iSLC No, you are wrong :-)
In addition, I did not use the GCC string class, I use my own string class with reference counting and copy-on-write support. PS: The algorithm you described is very similar to what is used in VC++ STL, not GCC :-) |
@r-lyeh Sorry, I can not found where the test scripts were stored, I guess you have some string performance test like this: https://codeplea.com/game-scripting-languages. So which algorithms we are using now? UPDATE: I found it under the "tests" folder. :-) |
@asbai I'm talking about GCC 5.x, 6.x and future versions. |
@iSLC Ok, so it's clearly that gcc 4.x is more benchmark friendly :-) Especially for engines like AngelScript which has the ability to avoid the memory allocation and copy cost of the script / native calling conversion. The memory allocation and copy cost of the native call is one of the biggest performance killer of dynamic languages. |
@asbai, only fib.as is currently benchmarked. the native* and prime* tests are part of the original article you linked and are yet to be converted to the rest of languages before evaluation. such a difficult/boring task! :) ps: the fib.as script is printing the result as I originally thought. this issue needs some global review before running the whole bench to be more fair at results. |
@r-lyeh Ok, I think the ability of fast native calling conversion will not cause unfairness, because it is a feature of the language and the engine. Just like JIT is a feature of some engine. But a line callback is unfair unless you have been registered this call back for every other engines. :-) PS: The author of AngelScript suggest us to use: |
Aha thanks, will do in the next run :) |
This is great.
The text was updated successfully, but these errors were encountered: