Try some things: (a) fewer allocations - parse context pool; lexer string pool (b) SWAR process multiple chars at once in keywords/enums/strs/stc.

This commit is contained in:
Thomas Krijnen
2026-03-27 20:45:13 +01:00
parent fe6e9d86ae
commit 603cedc487
14 changed files with 1266 additions and 860 deletions
+4 -22
View File
@@ -23,7 +23,6 @@
#include "ifc_parse_api.h"
#include "InstanceData.h"
#include "Header_section_schema.h"
#include "storage.h"
namespace IfcParse {
@@ -32,39 +31,22 @@ class IfcFile;
class IFC_PARSE_API IfcSpfHeader {
private:
IfcFile* file_;
IfcParse::impl::in_memory_file_storage* storage_ = nullptr;
std::array<std::shared_ptr<InstanceData>, 3> header_entities_;
/*
mutable Header_section_schema::file_description* file_description_;
mutable Header_section_schema::file_name* file_name_;
mutable Header_section_schema::file_schema* file_schema_;
*/
void readSemicolon();
enum Trail {
TRAILING_SEMICOLON,
NONE
};
void readTerminal(const std::string& term, Trail trail);
public:
explicit IfcSpfHeader(IfcParse::IfcFile* file);
explicit IfcSpfHeader(IfcParse::IfcSpfLexer* lexer);
~IfcSpfHeader();
// IfcParse::IfcFile* file() { return file_; }
// void file(IfcParse::IfcFile* file);
void read();
bool tryRead();
void write(std::ostream& out) const;
IfcParse::IfcFile* file() { return file_; }
void file(IfcParse::IfcFile* file);
void set_file_description(const std::shared_ptr<InstanceData>& data);
void set_file_name(const std::shared_ptr<InstanceData>& data);
void set_file_schema(const std::shared_ptr<InstanceData>& data);
const Header_section_schema::file_description file_description() const;
const Header_section_schema::file_name file_name() const;
const Header_section_schema::file_schema file_schema() const;