Translate
FileDict
The development methods being used now have completely changed, as AI tools push everything to a higher level. By focusing on ideas and designs, and as long as you have a perfect conception and process, AI's ability to write code is very powerful. If you can understand the code and know your requirements clearly, AI can help you write high-quality code and testing code, with productivity increased to previously unimaginable levels.
Perfect ideas and designs cannot be created just by imagination. Every time you encounter a problem, you need to do research to develop feasible details. Then, you must verify and revise your ideas and designs through testing. In the example of the fileDict below, this version was not written at the beginning but was developed after trying many approaches. Some features, like __del__ and __setitem__, had to consider many issues in their implementation, making it challenging to achieve perfection. The decision was made to change the data structure and add tags. To add a feature, it was necessary to review the entire process. The implementation of memory indexing also went through many attempts, ultimately deciding to use bisect and sorting during initialization. This approach balances performance and data security. Data is appended to the file each time it is added, optimizing access performance. Data is stored on the file immediately, reducing the risk of losing data. Finally, the storage and access performance and reliability were tested. The data is stored on the file, with only the hash and position loaded into memory. The test results on smartphones are still acceptable.
Passed the test on mobile and PC with hard disk drive without issues.
The final testing program is tested on a mini PC using a mechanical disk. First, create a Python Dict my_dict with 1,000,000 random items, a Python Dict my_dict1 with 100,000 random items, and then create a test fileDict test_dict for testing.
On smartphones with smaller dict.
1. Test fromItems, quickly build test_dict with my_dict with 1,000,000 random items.
2. Test rebuild.
3. Perform 100,000 __setitem__ operations on the fileDict test_dict with 1,000,000 random items, and test performance.
4. Perform 100,000 __getitem__ operations on the fileDict test_dict with 1,100,000 random items, test performance, and verify data reliability.
5. Perform 100,000 __delitem__ operations on the fileDict test_dict with 1,100,000 random items, and test performance.
I wrote this app using a text editor on Nokia Symbian. It only uses the core of Python and the canvas library. As a beginner, it was very challenging, and it took me months to finish my first project and publish it on the Nokia app store. I believe I am much smarter now than when I first started, but I lack the same determination and persistence as my past self. However, I have decided to complete all of my unfinished projects moreover, I will go much more further.
After a short period of exploration, the final decision was to use this version with a caching mechanism implemented using sqlite3. It has good performance in various aspects and has passed various tests. It can be used with confidence in different situations.
訂閱:
發佈留言 (Atom)
沒有留言:
發佈留言