Question about WML optimization
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Re: Question about WML optimization
Can you check how big is the save file? Although I have not found any indications for it, there might be a macro bloat somewhere and might generate really huge save files, whose generation might possibly take several seconds. Save files larger than one megabyte can be the cause.
Important note: macros, of 'the #define things', will only made the code more readable for humans or taking less place on the disk, they aren't likely to optimalise something.
Btw, your scenario looks quite interesting.
Important note: macros, of 'the #define things', will only made the code more readable for humans or taking less place on the disk, they aren't likely to optimalise something.
Btw, your scenario looks quite interesting.
Re: Question about WML optimization
1122 kbMax wrote:related topic: http://forums.wesnoth.org/viewtopic.php?f=21&t=38880
how big are your uncompressed save games?
I checked this theory. I created an event "side 3 turn" with 500 lines of different code and variables, after this I copied its one thousand times (and scenario became in 3 times larger than now). After this, I have changed names of these events (that they were different)Max wrote:i would assume that the lag is caused by preprocessing your scenario (macros). if you load a save game it's already cached.
But I didn't receive even the slightest freezing from it at the beginning of turns.
Re: Question about WML optimization
run it once with --log-debug=all. the output is usually huge, but it's probably easier than trying out different log domains.
Re: Question about WML optimization
Oh sorry )) I was wrong.
1122 kb size was when I have removed all defines (but all my events remained (12.000 rows of a code))
But if not to delete defines uncompressed size of save is - 42.866 kb. Compressed - 909kb.
if a problem here how to solve it? without deleting everything
1122 kb size was when I have removed all defines (but all my events remained (12.000 rows of a code))
But if not to delete defines uncompressed size of save is - 42.866 kb. Compressed - 909kb.
if a problem here how to solve it? without deleting everything
Re: Question about WML optimization
43 megabytes is surely a problem. Creating a compressed save file from this took like 5-10 seconds on my machine, always at the beginning of side 1 turn.
Because you probably don't have any custom units there, I suppose that the cause is macro bloat. That is, long macros possibly containing other (long) macros used a lot of times. They should be replaced by custom events, fire_event used instead of macro calls and variables instead of arguments. It is less comfortable, a bit slower, but it really decreases the size of save files. Read the topic Max showed you for more information.
Because you probably don't have any custom units there, I suppose that the cause is macro bloat. That is, long macros possibly containing other (long) macros used a lot of times. They should be replaced by custom events, fire_event used instead of macro calls and variables instead of arguments. It is less comfortable, a bit slower, but it really decreases the size of save files. Read the topic Max showed you for more information.
Re: Question about WML optimization
Thanks to all for help))
I redid as the "events" almost all the macros (which are often repeated in other macros) and size of saves was decreased in 10 times.
After this, new turns freezes only for 2-3 seconds, but it's nothing if to compare with the old 10-15 seconds.
I redid as the "events" almost all the macros (which are often repeated in other macros) and size of saves was decreased in 10 times.
After this, new turns freezes only for 2-3 seconds, but it's nothing if to compare with the old 10-15 seconds.