Now we are ready to start cranking. We have successfully completed some of the basic, though non-trivial tasks. These include representing the number in memory and also finishing the addition and subtraction. Now we can start up the program and test it. In the application linked just a few lines below I included a test method so feel free to play with the numbers. On my halfway decent system the results were the following. Here are the addition results for two 10MB (10* 1024 * 1024 digit numbers) files.
And for two 1MB (1024 * 1024 digit number) files the result are here.
We can remark on the speed of the procedure due to the chunk reading method. Of course better scores can be achieved with a good dual core CPU and proper memory and HDD read/write access times. For the two 10MB addition I managed to get a 450ms time on a dual core CPU. That's a significant difference. And don't forget, here's the source code for a more detailed view. Don't hesitate to download it, and may the muse of knowledge inspire you.
This is all for today. Make sure you come back for the second part, in which I shall discuss a more interesting problem, namely multiplication. It's going to be published here so don't go far. Until then I wish you a fantastic day.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |