Program Optimization C ++ abstract 3

Source: Internet
Author: User

1 Microsoft provides pageheap, a tool for detecting cross-border access by pointers.

2. Memory ing File

One of the hard-to-find problems is that the kernel object of the memory ing file created based on the system paging file is marked by passing in the hfile as the invalid_handle_value parameter, the returned value when a common hard disk file fails to be created or opened is invalid_handle_value.

......

Handle hfile = createfile (....);

Handle hmap = createfilemapping (hfile ,....);

......

This sectionCodeThe intention is to first create or open a common hard disk file, and then create a memory ing file kernel object based on this. However, if the first step fails to be created, an object based on the system paging file is generated.

Therefore, you must check the return value after calling createfile.

>>>>>>

ProgramStart optimization,Source code:

1. Reduce the number of configuration files started to read

In a system with a CPU of 2.6 GHz and a hard disk of 5400r/s, it takes about 40 ms to enable a stable operation. If the application contains 25 configuration files, it takes at least one second to open.

2. Pre-read files frequently accessed

You can compile a mapandreadthroughfile function using the memory ing file method in windows.

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.