Public byte Md5() => _md5.ComputeHash(_data) Public byte Sha512() => _sha512.ComputeHash(_data) Private readonly MD5 _md5 = MD5.Create() Private readonly SHA512 _sha512 = SHA512.Create() For those 2 methods we might know in our heads that MD5 hashing is faster than SHA512, but there could be other situation that you think some code is faster without having evidence for it. One to calculate MD5 hashing and one for SHA512 hashing of a random generated bytes. Lets create class CodeToBeBenchmark and say we have 2 fancy method for hash calculation, no thing special. Now lets make a simple example that I have made in my C# console app. The concept, Lets do it in C# with out framework It is also important to call method before the time starts as a warm to the main test. This can be achieved by calling the method you want to test x number of time and tick start and stop time. It happens often that you are developing a code and you need to test its performance and see if you can improve your code performance or just to create a performance report of your code. How to create a simple Benchmark Testing? The goal for benchmark testing is to test all the current and future releases of an application to maintain high-quality standards. Benchmark testing include software, hardware and/or network performance all together. Until we realize that it might perform very bad in specific condition or heavy load.įor instance lets say you develop a simple search mechanism to your application that preform very well when your application data is little, but at some point the application data grow at a level that your search solution break a part and can not deliver the expected results, as it might take long time to return the result.īenchmark testing in software is a repeatable testing method to measure program performance and compare the results against a previous release or other approaches to find out the result of best approach or/and to ensure that the program performance is with in the standards over time. As a software developer, some time we develop a peace of code even with unit testing and think that is world best code.
0 Comments
Leave a Reply. |