Commit Graph
6 Commits
Author SHA1 Message Date
Nikola Antonić 55c3151b06 [Kodi Krypton] backport libraries and Addons Framework from Kodi v17 (#164) 2024-07-15 17:12:44 +02:00
antonic901 5abf50c3d5 [83c758c] changed: RECT -> CRect for the video view window. 2024-06-06 12:20:07 +02:00
antonic901 6a28d05ec4 [StringUtils] merge StringUtils and StringUtils2 classes 2024-06-06 12:20:06 +02:00
antonic901 24ebf92a15 [CStdString] Faster substring comparisons - based on 621565a, ff2d98b
There were nearly 200 places in the code where testing for a substring was
being performed using a construct of the form
  CStdString::Left(len).Equals("string")
or the related CStdString methods Mid or Right. These are bad for performance
because they involve allocating a heap block for the duration of the
expression evaluation, for the purpose of holding the substring, and then
freeing it again.

These would need replacing anyway because CStdString is being phased out
(PR #3225), and there is also the maintainability issue that developers need
to keep the string lengths in step with the string literals. This latter
point is also true of a number of instances in the code of
  std::string::compare(0, len, "string") == 0

Now that the StartsWith() and EndsWith() methods in StringUtils have been
made more efficient, it is worth replacing both the above constructs with
such calls. This patch does so, using the case-sensitive versions where
std::string::compare was used, where the bUseCase parameter was specified
true in Equals() calls, or where the string literal passed to Equals()
contained no alphabetic characters. For the sake of compatibility, the
remaining calls have been left using the case-insensitive versions ("NoCase"
suffix to the method name), although these may be worth reviewing on a
case-by-case basis.

The majority of the changes here were achieved using a sophisticated search
and replace, which will hopefully minimise any bugs introduced in the
conversion.

This patch is expected to have wide-reaching performance benefits. One
benchmark (that can't pretend to exercise all ~200 improvements) is the time
to open the songs library: on a Raspberry Pi, this patch improves this time
by 12% (down from 13% for a previous version of this patch that also reduced
the number of calls to tolower()).
2024-06-06 12:20:03 +02:00
antonic901 463f0a7edb [b1304bb] Fixed potential overflows plus correct use of the system clock.
- finally get rid of timeGetTime() and GetTickCount() in main codebase
- there is couple of places which are still using GetTickCount() because they are tied to some hardware studff (joystick, input, lcd etc.)
2024-03-11 19:55:58 +01:00
antonic901 81ec8c15a1 changed: move CEvent* classes from utils to network 2024-02-06 03:30:32 +01:00