Skip to content

Commit 051b674

Browse files
authored
Implemented macro caching.
Macros up to a certain size (currently hard-coded to 65536 characters per macro) are now cached in memory, improving parsing speed of invocations, especially when the macro in question is defined in a different file.
1 parent 2d0a42c commit 051b674

27 files changed

+519
-430
lines changed

changes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Prior to the release of 3.7.1, the following items still need urgent attention:
4949
New Features
5050
------------
5151

52+
- Macros up to a certain size (currently hard-coded to 65536 characters per
53+
macro) are now cached in memory, improving parsing speed of invocations,
54+
especially when the macro in question is defined in a different file.
55+
5256
- All instances of `gray` in keywords or INI file options can now alternatively
5357
be spelt `grey`. Previously this was only the case inside function
5458
definitions (where it applied only to the `.gray` colour pseudo-component).

source/base/animation/animation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Image *Animation::ReadFrame(IStream *file)
279279
else if(file->tellg() > (prepos + bytes))
280280
throw POV_EXCEPTION(kInvalidDataSizeErr, "Frame decompressor read more bytes than expected. The input file may be corrupted!");
281281

282-
file->seekg(prepos + bytes, SEEK_END);
282+
file->seekg(prepos + bytes, IOBase::seek_end);
283283

284284
switch(fileType)
285285
{

source/base/animation/moov.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ void PostWriteFrame(OStream *file, POV_LONG bytes, const Animation::WriteOptions
172172

173173
// update mdat size
174174

175-
file->seekg(0, SEEK_END);
175+
file->seekg(0, IOBase::seek_end);
176176
pd->mdatsize = file->tellg() + 16;
177-
file->seekg(8, SEEK_SET);
177+
file->seekg(8, IOBase::seek_set);
178178
WriteInt8(file, pd->mdatsize);
179-
file->seekg(0, SEEK_END);
179+
file->seekg(0, IOBase::seek_end);
180180

181181
if(bytes > 2147483647) // 2^31 - 1
182182
throw POV_EXCEPTION(kInvalidDataSizeErr, "Cannot handle frame data larger than 2^31 bytes!");
@@ -387,9 +387,9 @@ void ReadAtomHeader(IStream *file, Type& type, POV_LONG& size)
387387
ReadType(file, type);
388388
389389
POV_LONG t = file->tellg();
390-
file->seekg(0, IOBase::SEEK_END);
390+
file->seekg(0, IOBase::seek_end);
391391
size = file->tellg() - t + 8;
392-
file->seekg(t, IOBase::SEEK_SET);
392+
file->seekg(t, IOBase::seek_set);
393393
}
394394
else if(size == 1) // atom sizes is outside 32-bit range
395395
{

0 commit comments

Comments
 (0)