Here is a benchmark of mine vs the original typical FindPattern you posted:
Code:
FindPattern Benchmark Example
(c) 2014 atom0s
================================================
Test Name : FindPattern
Test Author : dom1n1k & Patrick (GameDeception)
Test Time : 0.681074
================================================
Test Name : FindPattern (C++11) w/ Async
Test Author : atom0s
Test Time : 0.235662
In this benchmark app, I am scanning a total of 26 patterns. The way I have the benchmark setup is each test is given 3 functions:
- Initialize
- Release
- RunTest
Initialize is used to simply handle the basic stuff that the test may need to prepare itself for the test to be ran. Things that are not specific to the scanning directly. Such as any object creation and so on.
Release is to allow the test to cleanup anything it created etc.
RunTest is to allow the test to do its work to scan for all the signature in the given test data.
About The Tests
The test data is the Final Fantasy XI's main game file 'FFXiMain.dll'. I load the unpacked file into memory as the raw bytes, I do not actually load the game in any manner, so these are static scans from the files raw data.
Each test is given a total of 26 signatures to scan for within the same memory data.
So the benchmark is entirely fair in terms of what to look for and what it is looking within.
I created the C++11 / async method I use solely for this game and decided to share it since others may find it useful for faster and threaded scans. In an application where you only need to scan for a few signatures and do not need threading, then yeah mine may not be the best bet however, so far it has performed the best for me outside of some other methods I discussed on my personal site that a friend of mine (devnull) and I came up with.
There is definitely room for improvement and speed increases, this is just the fastest and cleanest method that devnull and I came up with so far that was easy to read and maintain while keeping speed and performance.