Internals: Use and enforce class final for ~5% performance boost.

This commit is contained in:
Wilson Snyder
2020-11-18 21:32:16 -05:00
parent c0888c1b0f
commit b6ded59c2b
224 changed files with 976 additions and 949 deletions
+3 -3
View File
@@ -37,7 +37,7 @@ class FileLine;
//! This singleton class contains tables of data that are unchanging in each
//! source file (each with its own unique filename number).
class FileLineSingleton {
class FileLineSingleton final {
// TYPES
typedef std::map<const string, int> FileNameNumMap;
// MEMBERS
@@ -64,7 +64,7 @@ protected:
};
//! All source lines from a file/stream, to enable errors to show sources
class VFileContent {
class VFileContent final {
// MEMBERS
int m_id; // Content ID number
std::deque<string> m_lines; // Source text lines
@@ -87,7 +87,7 @@ std::ostream& operator<<(std::ostream& os, VFileContent* contentp);
//! This class is instantiated for every source code line (potentially
//! millions). To save space, per-file information (e.g. filename, source
//! language is held in tables in the FileLineSingleton class.
class FileLine {
class FileLine final {
// CONSTANTS
static constexpr unsigned SHOW_SOURCE_MAX_LENGTH = 400; // Don't show source lines > this long