Commit Graph

58 Commits

Author SHA1 Message Date
RoosterDragon
a1dfb42812 Fix IDE0251 2023-08-11 15:51:53 +02:00
Vapre
edbded8f0a PerfTickLogger, reduce overhead of logging long ticks. 2023-07-01 18:07:27 +02:00
RoosterDragon
f4af5c1764 Fix CA1852 2023-06-06 11:51:47 +03:00
Matthias Mailänder
1c2ce0dcc0 Deprecate string format log shorthand. 2023-05-05 19:03:09 +02:00
RoosterDragon
8a285f9b19 Fix IDE0090 2023-04-08 16:51:51 +03:00
abcdefg30
5bf7fe852c Remove the copyright year numbers 2023-01-11 11:58:54 +02:00
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
teinarss
10676be377 Replace F extension with string interpolation 2021-05-08 22:20:59 +02:00
reaperrr
e161d9daa7 Misc TraitDictionary style fixes 2021-04-10 15:59:24 +02:00
reaperrr
aa834db1e3 Make perf.log output for ticking things opt-in
Both writing to perf.log frequently as well as GetTimestamp
aren't free and hurt performance particularly on slower systems
(which can have notably higher output to perf.log, further
amplifying the problem).
Therefore we make simulation perf logging opt-in.

Additionally, logging of the current tick and tick type
(local/net) is removed from debug.log, and some
remnant debug logging for kills and pips is removed
to keep performance-sensitive logging limited to
perf.log.
2021-04-10 15:59:24 +02:00
teinarss
6b74093c04 Add readonly to structs 2021-03-14 15:17:57 +01:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
Vapre
38f1f1e5c2 Replace TraitContainer.AllEnumerator with ApplyToAll.
As proposed in the past in #13577.

Replace TraitContainer.All() that uses the custom AllEnumerator with
TraitContainer.ApplyToAllX() that takes an action as argument.

The AllEnumerator.Current function show up in profiling reports since it is
used each tick multiple times for multiple traits. The function is 'heavy'
because it creates TraitPair<T>'s temporary objects for each actor
trait combination.

In the past about 20k ITick trait pairs were present during an average
multi player game.

Using an Apply function that takes an action avoid the need to create
these temporary objects.

To be able to still use 'DoTimed' somewhat efficiently the measurement
was moved to inside the trait container method.

Results in a 25% performance improvement in accessing all traits of
a certain type.

Apply function could be used for other TraitContainer functions as well
for further improvements.

Test result for calling on a dummy trait on 20k actors a 1000 times:
  1315 ms traitcontainer.AllEnumerator (current)
   989 ms traitcontainer.Apply (this commit)
2020-10-29 21:21:12 +00:00
teinarss
d52e4793fe Refactor classes to structs 2020-08-19 11:54:29 +02:00
abcdefg30
26fc65209d Fix the bogus Actors iterator 2020-07-09 18:11:53 +02:00
Vapre
9edda21b06 Avoid three time array lookup in TraitContainer.Actors. 2020-07-09 12:16:04 +02:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
Andre Mohren
ebc533ed53 Exception should inform which actors causes it. 2019-07-27 10:44:30 +01:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
RoosterDragon
3026bdcea5 Implement equality on TraitPair. 2016-01-17 00:13:06 +00:00
RoosterDragon
b0619a3e25 Added comments in performance sensitive code. 2015-12-13 16:24:54 +00:00
RoosterDragon
aaa82339d1 Small cleanup in TraitDictionary. 2015-12-12 20:46:10 +00:00
atlimit8
b6f17df260 Add ActorsHavingTrait<TTrait>([Func<TTrait, bool]) 2015-10-28 16:36:45 -05:00
atlimit8
85fab45451 Remove Actor.HasTrait<T>() 2015-09-19 09:49:23 -05:00
Matthias Mailänder
e428e6d8cc remove executable bits from source code 2015-08-06 18:05:50 +02:00
Matthias Mailänder
894f75fb3b provide a more helpful exception 2015-08-02 17:29:44 +02:00
Paul Chote
585a43fd8f Rename Actor.Destroy/Destroyed to Dispose/Disposed. 2015-05-29 19:08:38 +01:00
RoosterDragon
a3898db660 Speed up TraitContainer.RemoveActor.
Use the binary search invariant of the lists to find the actor quickly and remove the range of entries from the list in a single operation to avoid redundant copying otherwise caused by removing entries one by one.
2015-02-17 00:02:43 +00:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
Oliver Brakmann
30e42cdc62 Merge pull request #7247 from Hellhake/stylecop-game
Fix StyleCop warnings in OpenRA.Game
2015-01-02 12:58:04 +01:00
Hellhake
5a97a4b63b Fix StyleCop warnings in OpenRA.Game 2015-01-02 12:11:01 +01:00
Hellhake
fa72e04042 Remove BOM 2015-01-01 22:51:12 +01:00
RoosterDragon
85734defec Improve trait enumeration speed for All and GetMultiple.
Use a hand-rolled enumerators to avoid the overhead from compiler generated enumerable blocks. This trades terseness for some minor performance gains.
2014-06-17 22:11:23 +01:00
RoosterDragon
909c5c7037 Some minor cleanup in TraitDictionary and affected callsites. 2014-06-17 22:10:41 +01:00
ScottNZ
90894aa03e Use var everywhere 2014-06-15 22:17:34 +12:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
Chris Forbes
5eb61dbdd2 Merge pull request #5411 from RoosterDragon/general-clean
General Cleanup
2014-05-25 11:03:03 +12:00
RoosterDragon
b733465f33 General uncontroversial cleanup:
- Made private methods static where possible (runtime can elide checking the object for null).
- Declared attribute classes as sealed (allows reflection on attributes to complete faster).
- Moved some static cctor's into field initializers (static cctor's are slower than static field initializers).
- Made classes static if they contained only static methods (can't create instances of useless objects).
- Use inferable Exts.Lazy and not new Lazy<T>().
- Added required STAThread attribute to CrashDialog.
- Removed unused parameters in private methods.
- Added Serializable attribute to exceptions.
- Added parameter name in calls to ArgumentNullException.
- Use of as operator instead of is + cast.
- Changed (x as Foo).Bar anti-pattern into ((Foo)x).Bar. Results in sensible cast exceptions on error rather than null dereferences.
- Removed unused method in NullShader.
2014-05-23 15:50:54 +01:00
RoosterDragon
da6b5c1ce4 Fixed TraitDictionary.Contains to use Any() rather than Count() != 0.
This means it can bail early if a match is found.
2014-05-23 08:25:47 +01:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
Matthias Mailänder
6dc02c3b26 StyleCop 2014-02-09 18:27:25 +01:00
Chris Forbes
418b8d40f9 improve TraitDictionary error messages 2011-12-28 08:02:09 +13:00
Chris Forbes
40029c6688 use string.F() extension method everywhere possible; fix various small issues in error messages 2011-12-13 23:57:23 +13:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Chris Forbes
0b0e857b13 write traitreport to a file on disconnect, not stdout 2011-04-29 19:38:54 +12:00