The Pawn Memory Squeeze
2 Attachment(s)
In Pawn, repeated strings are not represented by the same object or memory like in Java so this is an exercise to remedy that by tossing strings on the heap to stop redundancy in memory and save memory.
This script does two things: A) Generates a dump file with all the tokenized data first (for fun), then the two string tables at the end of the file. The first one lists all strings and how many times they are repeated, the second one only contains repeated strings that are long enough to be considered. It reports how much memory can be saved by optimizing out everything. B) Generation of an optimized source code file. Compiling this will make the amxx file take up less resources as reported by the compiler. To begin processing (after you installed this plugin, of course) call amx_memorysqueeze from console upon a .sma file in your scripting directory. At the end of processing, a report is generated on how much memory can be saved, and a new file is outputted in scripting with _memsqueeze.sma ending. The strings tossed on the heap should be declared before the very first function. The symbol dump is located in the matching txt file. This does not have the ability to see around aliases to strings, ex defines, although it is possible. Notes: put a #define MEMORYSQUEEZE somewhere in your source file at top, and there will be dumped all the strings placed on the heap. Otherwise it will try to autoguess where the first function is defined and define the replacements immediately before the function. The following is an example of how good this works, even on the largest plugins. Quote:
|
Re: The Pawn Memory Squeeze
Very interesting! I'll have to take a look into how this works. :D
|
Re: The Pawn Memory Squeeze
Wow, that is an insight and a half man :D
|
Re: The Pawn Memory Squeeze
Proof it works :)
I changed some of what your plugin does into mine (saving memory with strings) and also changed certain variables from "new" to "static". Here was my result: [img]http://img167.**************/img167/7808/06192008212554fr0.png[/img] Thanks :up: |
Re: The Pawn Memory Squeeze
Actually this is very interesting as soccdoodcss said.
I have to try it asap when I get home from the country side. |
Re: The Pawn Memory Squeeze
A nice file and string manipulation, looks interesting...
|
Re: The Pawn Memory Squeeze
Code:
You should mention this plugin is for AMX/X 1.80 & higher only. I think using such a tool via amx/x is more complex than a separate (console application or standalone script) tool. But i was still impressed :) |
Re: The Pawn Memory Squeeze
1 Attachment(s)
I have tried this out an it is not working.
- Made sure your plugin was working - I uploaded the deagsmapmanager.sma to the scripting folder. - amx_memorysqueeze deagsmapmanager.sma in console - Got the deagsmapmanger_memorysqueeze.sma - Downloaded & added #define MEMORYSQUEEZE - Attempted to compile and got the error "Could not locate outputfile <compile failed>." Could you help? Attachment 28995 |
Re: The Pawn Memory Squeeze
Found the problem. Try the new code and report back
|
All times are GMT -4. The time now is 10:29. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.