make Pos smaller
reduces peak hep memory use on eval of our test system from 264.4MB to 242.3MB, possibly also a slight performance boost. theoretically memory use could be cut down by another eight bytes per Pos on average by turning it into a tuple containing an index into a global base position table with row and column offsets, but that doesn't seem worth the effort at this point.
This commit is contained in:
parent
c96460f352
commit
47baa9d43c
2 changed files with 7 additions and 7 deletions
|
@ -23,14 +23,13 @@ MakeError(RestrictedPathError, Error);
|
||||||
|
|
||||||
struct Pos
|
struct Pos
|
||||||
{
|
{
|
||||||
FileOrigin origin;
|
|
||||||
Symbol file;
|
Symbol file;
|
||||||
unsigned int line, column;
|
uint32_t line;
|
||||||
|
FileOrigin origin:2;
|
||||||
Pos() : origin(foString), line(0), column(0) { }
|
uint32_t column:30;
|
||||||
Pos(FileOrigin origin, const Symbol & file, unsigned int line, unsigned int column)
|
Pos() : line(0), origin(foString), column(0) { };
|
||||||
: origin(origin), file(file), line(line), column(column) { }
|
Pos(FileOrigin origin, const Symbol & file, uint32_t line, uint32_t column)
|
||||||
|
: file(file), line(line), origin(origin), column(column) { };
|
||||||
operator bool() const
|
operator bool() const
|
||||||
{
|
{
|
||||||
return line != 0;
|
return line != 0;
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef enum {
|
||||||
lvlVomit
|
lvlVomit
|
||||||
} Verbosity;
|
} Verbosity;
|
||||||
|
|
||||||
|
/* adjust Pos::origin bit width when adding stuff here */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
foFile,
|
foFile,
|
||||||
foStdin,
|
foStdin,
|
||||||
|
|
Loading…
Reference in a new issue