Experience in WM Performance Optimization

Source: Internet
Author: User

Yesterday, I heard about how to optimize SQL Server compact in the Performance Tuning course of SQL Server compact.

It mainly includes some optimizations on the data access layer, tables, and SQL language. Here, I will not repeat it again.

SQL Server compact optimization is only part of WM development. How to select different technologies and optimize them in actual projects based on actual conditions to continuously improveProgramPerformance is what we must pay attention.

At present, WM has been widely used in the field, from the initial logistics system to the current meal and ordering, from the industrial field to the current personal household. Different fields have different requirements.

Let's start with the WM client.

On the client, because the C/S program is used, the performance depends mostly on the device and the. net cf version.
In addition, P/invoke calls are also quite performance-consuming. Note that there is a loadlibrary/freelibrary pair in P/invoke.
Load the DLL before calling the API. Free it after use, can accelerate performance.
As an enterprise-level application, there is almost no problem. (After all, the interface is relatively simple, basically adding, deleting, modifying, and querying interfaces)
But as a personal application, such as text message interception, phone blocking, and so on. . Net CF is often unable to cope with the need to call a large number of APIs.
In addition, the 3D class is also very bad, just like the decoration, it is better to use 2D images instead.
We recommend that you do not have too many controls on the interface. You can put images and other files in a resource file, which is faster than direct access to external resources.
Use Using to create and release objects.

Use SQL Server compact on WM devices. Note that this database version is a file-type database. When using ado.net for access, pay attention to some optimizations.
1. Replace dataadapter with datareader.
2. sqlceresultset can be easily accessed back and forth.
3. tabledirect is faster than select, but can only access a single table.
4. It is best to index the table to improve the SQL speed.
5. I personally think that list <t> can be used, and dataset is not recommended to consume performance.

SQL Server compact synchronization problems. Microsoft has released ado.net Sync service for device. Although powerful. However, if the data volume is large, the synchronization time is slow and a relatively stable network environment is required.
As appropriate, if it is similar to an order, you can immediately call web service to notify the server after placing the order.
Sync synchronization is not used for product inventory tables and so on, because, once there are many clients, the table on each client is inconsistent with the master table, there is a conflict. There is no problem with 1-to-1 synchronization. The synchronization of multiple to one cannot be well solved.

Socket Connection: Set the socket timeout time. Do not set it to too long. If it is too long, it will still fail.

We recommend that you use the following methods:
Save local data to SQL Server compact. After an interval, you can call Web Service for batch update.

During communication, whether you enable WIFI or GPRS, remember to disable it if you do not need to enable it. GC is collected every other time. Although your program is very stable, if you occupy a lot of memory and other programs do not advocate it, it will also affect your program. Because the memory is very valuable, it is important to avoid making data copies. And most importantly,CodeYou must create the data only when you need it and discard it when you finish the work.

Summary:
. NET Compact framework is good at memory management, event processing, object-oriented programming, user input, internationalization, and file I/O, the biggest challenges are graphics, window management, and resource management.

The above is my summary of WM experience. Hope to share with you ~

Author: appleseeker (Feng)
Date: 2009-02-20

introduction: mobile development index

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.