Optimal Storage Management Policy for Windows Mobile apps [translation]

Source: Internet
Author: User

Origin: I compiled a small program a few days ago. I want to put a text file into an array. Although I have read all the files, I cannot search the back part of the file due to an error, after a few days, I found that the memory was insufficient during the operation, so I changed the array to dynamic application, and then OK. therefore, we have to consider the memory usage and running efficiency. I saw the Windows Mobile SDK update document on Microsoft's msdn a few days ago (even though I saw updates on Microsoft's msdn in the early August S, I only saw some updates at that time ), I found the following article and translated it into Chinese:
(Please advise me if the translation is incorrect)

Best practices for managing storage in a Windows Mobile-based application

Storage hardware and overall system design have a great impact on storage performance. currently, the Pocket PC device uses a ram-based file system, while the smartphone device uses a permanent storage file system based on flash memory (falsh. for a deeper understanding of the storage hardware technology, see:
System memory management in Windows CE. net

Storage hardware performance considerations

The following table compares the operating performance of a flash-based Permanent storage file system with a ram-based file system:

Operation Based on flash Based on Ram
Partial read Slow Fast
Partial write Very slow Fast
Network read Fast Slow
Network write Fast Slow
Battery backup hardware? No Yes
Permanent registry? Better than Ram-based Yes
Optimal storage software performance policies

Follow the best practices below to help minimize any performance impact, so your application must:

  • (1) Minimize the application sizeThat is, the application should be as small as possible
  • (2) Minimize the number of permanently stored data. Because the resources of the file system may be limited, make sure that your application can tolerate a storage system that is not always running.
  • (3) Minimize the frequency of updating data.Do not change data frequently.
  • (4) minimize any periodic writes to the Registry.Do not write the Registry frequently.
  • (5) Minimize the number of dynamically connected databases (DLLs.If it is not called frequently, the dynamic library is more advantageous than the static library, but remember to uninstall and release the dynamic library after you use the dynamic library.
  • (6) Minimize cyclic detection.With the event-driven design, your application can detect any required changes, rather than using the while loop statement.
    Run a small amount of code. The code is compressed and stored in the Rom, so the Code must be decompressed before it can be run. Decompressing the code affects the performance. For example, on a typical smartphone development platform, it takes 3 ms (MS) to decompress a page of code ). In addition, code execution consumes power unless absolutely necessary (required) and does not run the code whenever possible.
  • (7) run the Code only when appropriate.For example, an application stops its activity when it is invisible to users.
  • (8) Minimize read/write to the Flash hardware.On a typical smartphone development platform, writing a page of code to flash hardware takes 83 milliseconds (MS. Use writing data to ram as much as possible to replace writing data to flash memory (note: the previous table shows that local writing to ram is faster than writing to flash memory ). If writing to flash memory is inevitable, the write time should be postponed as much as possible. Writing to flash memory consumes more power than writing to ram. Therefore, writing to flash memory is minimized to reduce power consumption.
  • (9) mark the driver as pageable as much as possible ).As long as the driver is not running during suspension or recovery and the driver is not in maintenance page error (missing page ?), We can mark the driver as a callable page. Ram contains drivers and DLL files for all callable pages. At startup, all non-page drivers and DLL files must be decompressed into RAM. (Note: As mentioned above, it takes time to decompress the package)

    Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/mobilesdk5/html/moconbestpracticesformanagingstorageinwindowsmobileapplication. asp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.