iOS Project optimization: executable file Slimming

Source: Internet
Author: User

1. Delete Unused resource files

All 1X images can be erased.

Duplicate pictures in two, one is the same name of the picture, if you use the. Xcassets to manage the picture, then the left sidebar of Xcode will have a warning to repeat the name of the image, just follow the prompt one by one to deal with. The other is a different name, but the same file image, we use a Python script (@ Ganchu Jiang) to scan, each time the compilation of the script execution, if there is a scan hit will make Xcode compile failure, at this time need to manually handle. One thing to be aware of is the use of. Xcassets to manage the picture back when there is a mapping relationship, through the imagenamed: Method used by the name and the real name of the picture may not be the same, the script scanning needs to be specially handled.

Unused images can be scanned through the lsunusedresources, but note that there may be accidental injury, the tool is a full match, some stitching the name to use the picture to pay attention to manual culling. I was punished for mistakenly deleting pictures O (╯-╰) o

Some audio, video and redundant plist files and Readme files can only be visually scanned, we do not use these resources for the time being this problem.

2. Resource compression

The first is image compression, Imageoptim tool can achieve lossless compression.

For pictures, it is recommended to use Apple's recommended. Xcassets to manage it, which compresses all of the PNG-formatted images into a Assets.car file, and the compression ratio is higher than other ways of managing the image. However, the test found JPG images will not be in the Assets.car file.

Alternatively, if you can use audio or video resources, you may also consider compression.

3.h5 Page Remoting

If your H5 has local pages and resources, you can consider all of the remoting. The local resources are mainly JS, HTML files and pictures.

4. Part of the Code optimization

Open the corresponding project file by Appcode choose Code-> Inspect Code Analysis to remove useless references and code.

5. Analyzing the executable file

(In the following way I have not read it after the moment)

Using link map
Xcode turn on compile option write Link Map File
Set the Write Link map file option to Yes on the map---Settings, Build, XCode, Project
Files named Xxxlinkmapxxx.txt can be found in the Compiled project folder (winodw-project-derived data-build-intermediates-xxx.build-corresponding Debu G or release file) analysis of the TXT file, you can get the project compiled by the various modules generated by the. o file in the executable file composition.

How to analyze
This article uses the node + JS method analysis. JS Code address HTTPS://GIST.GITHUB.COM/BANG590/8F3E9704F1C2661836CD Use method, node JS path xxlinkmapxxx.txt path-HL analysis out too large can consider the reduction and replacement.

iOS Project optimization: executable file Slimming

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.