This improves performance quite a lot because it avoids a huge number of
calls from C++ to JS. Check the ticket for performance measurements.
Refs #2913
This was SVN commit r16337.
This avoids vswprintf failures when printing non-ASCII char* strings
from CLogger into the console.
Also convert ScriptInterface::ToString to return UTF-8, to avoid some
utf8_from_wstring calls.
Also remove some unused and redundant CConsole functions.
This was SVN commit r16333.
This fixes the problem where passing a non-ASCII string to
debug_printf(L"%hs", s) caused vswprintf_s to fail on Linux (because it
doesn't know what encoding the char* is meant to have). Now debug
messages will remain as UTF-8 until they reach the OS.
Fixes#3021.
This was SVN commit r16332.
It is necessary to rely on shared los masks, else some visibility
updates will be missing.
Refs #2913, see this ticket for a performance graph.
This was SVN commit r16328.
Fixes the animals hidden in the FoW, and adds the missing status bars
for mirages.
Also small cleanup of the code.
Refs #2913
This was SVN commit r16281.
I've reverted this workaround before the SM31 commit because I thought
it's only a problem with VS2010. Actually VS2013 still doesn't support
C++11 well enough and still requires the workaround.
Refs #2669, #2462
This was SVN commit r16215.
This upgrade also introduces exact stack rooting (see to the wiki:
JSRootingGuide) and fixes problems with moving GC. This allows us to
enable generational garbage collection (GGC).
Measurements a few months ago have shown a performance improvement of a
non-visual replay of around 13.5%. This probably varies quite a bit, but
it should be somewhere between 5-20%. Memory usage has also been
improved. Check the forum thread for details.
Thanks to everyone from the team who helped with this directly or
indirectly (review, finding and fixing issues, the required C++11
upgrade, the new autobuilder etc.)! Also thanks to the SpiderMonkey
developers who helped on the #jsapi channel or elsewhere!
Fixes#2462, #2415, #2428, #2684, #1374
Refs #2973, #2669
This was SVN commit r16214.
Everything is char* now, so we don't need to mess around with different
string types.
Done with:
ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs perl
-pi -e'1 while
s/(LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR).*)%[hl]s/$1%s/g'
This was SVN commit r16187.
Done with:
ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs sed
-i 's/LOG\(MESSAGE\|MESSAGERENDER\|WARNING\|ERROR\)(L/LOG\1(/g'
This was SVN commit r16183.
sys_vswprintf relies on platform-specific printf implementations, which
vary widely between platforms (in handling of truncation, return values,
use of %s/%S/%hs/%ls for mixing char and wchar_t strings, etc) and are
therefore a pain.
Use cppformat's fmt::sprintf instead, which has very similar syntax to
sprintf but is more C++ish and is portable.
Also, wchar_t is stupid, so use char* strings (which are expected to be
UTF-8) in CLogger. This creates a bit of a pain with changing all
callers to convert to char* strings, but that's their fault for not
using UTF-8 already.
Refs #3011.
This was SVN commit r16182.
Local types shall not be used as a template argument. So move it
to a higher scope. This restriction was lifted in C++11, so we
might want to change this back when we switch to that.
This was SVN commit r16101.
First, do a ray intersection test with the bounding-sphere for all
entities on the map and then check the more detailed selection shape for
the remaining candidates. Do checks that require component lookups after
the ray intersection tests because these are relatively expensive.
The old method for figuring out which entities are below the mouse
cursor was incorrect because it does a 2D check to filter out the first
candidates which can lead to incorrect results with lower camera angles
and high buildings or buildings with a large footprint. Such problems
were avoided with quite a large radius for this 2D test and resulted in
a large number of candiate entities after this first test (200-500).
Also rename PickEntitiesAtPoint to PickEntityAtPoint and make it return
only one (the closest) match.
I've tested performance with the tracelogger by starting a map and then
moving the mouse in circles for one minute. The results were relatively
stable. I've compared the total time percentage of input.js:836, which
spends nearly all of the time in PickEntityAtPoint.
Ardennes Forest - Normal size: Original: 41.46% Patched: 31.6%
Ardennes Forest - Giant size: Original: 40.59% Patched: 51.55%
As we see, it's faster on normal map sizes but slower on giant maps with
a lot of entities.
This approach can be further improved with some kind of spatial
subdivision for the culling (like an octree), which would help the unit
renderer too. This way it should be possible to make it faster (and
still correct) on all map sizes and with a large total numbers of
entities.
This was SVN commit r16098.
On my ESR31 branch, I've made two measurements with different replays
(both around 15000 turns).
In the first, I got around 3% performance improvement and in the second
about 7.5%. It mainly depends on how often aura changes related to the
female citizen aura happen.
This was SVN commit r16055.
The runtime is becoming more and more important in the JSAPI. As a
result, we also have more functionality on the runtime level and having
the whole ScriptRuntime class hidden in ScriptInterface.cpp doesn't make
sense anymore. ScriptInterface.cpp also has become quite a large file
and pulling out the runtime part makes it a bit smaller.
Refs #2462
This was SVN commit r15961.