Code Comparer by JustinOther and Cipscis
Skyrim » Utilities
Added: 07/09/2012 - 04:45PM
Updated: 08/09/2012 - 10:16PM

13 Endorsements

1.00 Latest version

75 Unique D/Ls

91 Total D/Ls

4,967 Total Views

Uploaded by JustinOther


Last updated at 22:16, 8 Sep 2012 Uploaded at 16:45, 7 Sep 2012

Name: Code Comparer (Papyrus)

Thread @ Bethsoft:

By: JustinOther (Isaak Mills) and Cipscis (Mark Hanna)

Version: 1.00

Description: This is a utility designed for testing the efficiency of Papyrus snippets in the time honored tradition of Cipscis' Code Comparers for Fallouts. There's often more than one way to skin a cat, but which way is the most efficient? This tool aims to provide an easy way to measure multiple snippets' speed/efficiency. While the efficiency of any single script or line of code is generally inconsequential, every little bit helps, so cumulatively scripts' efficiency does matter. There are eight empty slots at the top of CodeComparerQuestScript.PSC numbered 0-7. The tests will iterate the inserted code an allotted number of times (default is 10^4 or 10,000 iterations) upon selection from the "Test" submenu, recording the relevant information to %UserName%\Documents\My Games\Skyrim\Logs\User\Code Comparer.log and the associated Profiling logs. If multiple snippets from within the menu before beginning a test, the fastest snippet will be reported.

Requirements: Skyrim v1.6.0.89 or later.

Installation: Unpack the contents of the .7z into Skyrim\Data. Activate Code Comparer.esp when testing.

Uninstallation: Deactivate the plugin and/or delete the associated files.

Other contents:

Code Comparer.ini: This enables the necessary debug features such as logging, profiling, etc.

Code Comparer - Purge logs.bat: It's just a quick way to delete all the .log files that accumulate, making it easier to find your test results and/or clean up your Logs directory after testing.

Script Logs - Shortcut.lnk: It's just a shortcut to the script log folder for easy access. You can drop the .bat into the shortcut after installation to store it with the .log files it deletes.

Use: Insert code into the empty slots found in CodeComparerQuestScript.PSC's SpeedTest function (it's right up top) and compile. Make sure Code Comparer.esp is set to load with the launcher and load a save, preferably a clean save in an area with little going on. To start tests open Code Comparer's menu. Depending upon whether SKSE is installed or not, the menu is accessed differently.
If a sufficiently current version of SKSE is installed: Press and briefly hold R-Shift (key is rebindable from within menu)
If SKSE is not installed or is an insufficiently current version: You will find an apparel item, [Code Comparer], in your inventory. When equipped, the menu will be prompted.
Once in the menu, you can choose the "Test" submenu, and select the snippet to test. You'll see a notification about the test starting and completing along with the time elapsed once a test is complete. This information and more is recorded in the aforementioned logs. By default, tests will iterate 10,000 times, but you can adjust the iterations from within the "Options" submenu. Note that the menu will not come back up until the current test is completed and that there's no way to cancel the tests for the sake of isolating the snippets and not adding overhead. Taking larger samples will render more accurate results, but be prepared to wait awhile as some tests may take a long time to finish. Note that Code Comparer, in order to increase the accuracy of the results, calibrates itself to offset the overhead of an empty test. Changing the iterations value will prompt recalibration which might take a moment if using higher values.

Profiling: "The profiling log format is as follows:


With being the standard