CN108520031A - Method for increasing webpage loading speed - Google Patents

Method for increasing webpage loading speed Download PDF

Info

Publication number
CN108520031A
CN108520031A CN201810259605.0A CN201810259605A CN108520031A CN 108520031 A CN108520031 A CN 108520031A CN 201810259605 A CN201810259605 A CN 201810259605A CN 108520031 A CN108520031 A CN 108520031A
Authority
CN
China
Prior art keywords
page
page data
data
webview
full dose
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201810259605.0A
Other languages
Chinese (zh)
Inventor
余敬龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Nenglong Education Co ltd
Original Assignee
Guangdong Nenglong Education Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Nenglong Education Co ltd filed Critical Guangdong Nenglong Education Co ltd
Priority to CN201810259605.0A priority Critical patent/CN108520031A/en
Publication of CN108520031A publication Critical patent/CN108520031A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for improving webpage loading speed, which comprises a first flow chain and a second flow chain which are processed in parallel; the first flow chain comprises the steps of registering an NSUrl protocol custom subclass, creating and initializing WebView, initiating a page request by the WebView, and intercepting the page request sent by the WebView by the NSUrl protocol custom subclass; the second process chain comprises the steps of constructing network connection of NSUrlSession, receiving the page data responded and generating memory flow; after the step S4 and the step b2, streaming bridging is performed, the nsUrl protocol custom subclass loads page data, a child thread is started, page data are obtained from a memory stream and returned to the WebKit kernel, and the WebView renders a page according to the page data.

Description

A method of promoting load webpage speed
Technical field
The present invention relates to page loading processing field, especially a kind of method that can promote load webpage speed.
Background technology
Since the H5 pages have the advantages such as iteratively faster, flexible configuration operation, in current mobile terminal mainstream APP, H5 Page proportion is increasing.The mode of traditional IOS terminal loads H5 pages is to be completely dependent on primary WebView groups Part first completes a series of WebView initialization flow, after waiting WebKit kernels ready, then is completely dependent on by WebView Network goes the related resource of request loading page, data.
This mode has the disadvantages that, 1) primary WebView assembly initializations are needed etc. just to the request of loading of the page Just start after thread, and this initialization procedure takes much, and request opportunity is caused to relatively lag behind;2) the resource sum number of loading page According to network is completely dependent on, causes the page prolonged white screen phenomenon occur, influence user experience.
Invention content
In order to solve the above technical problems, the object of the present invention is to provide a kind of flows that WebView assembly initializations are ready Chain and the flow chain of loading page data bridge the method to improve loading page speed by streaming after parallel processing.
The technical solution adopted by the present invention is:
A method of load webpage speed is promoted, the first pass chain and second procedure chain of parallel processing are included;
First pass chain includes the following steps:
The self-defined subclasses of NSUrlProtocol of a1, registration for intercepting WebView requests;
A2, it creates WebView and initializes;
A3, WebView initiate page request;
The self-defined subclass of a4, NSUrlProtocol intercepts the page request that WebView is sent out;
Second procedure chain includes the following steps:
B1, the primary network connection based on NSUrlSession of structure, according to the page request page data that need to be loaded;
B2, receiving step b1 send out the page data responded after request, generate memory stream;
It is bridged with streaming after step b2 after the step S4, and further includes step:
C, the self-defined subclass loading page data of NSUrlProtocol open sub-line journey, page number are obtained from memory stream According to, and return to WebKit kernels;
D, WebView renders the page according to page data.
Further include b21 after step b2, after receiving page data, be written local cache.
In the step b1 after receiving full dose page data, full dose page data is analyzed according to page formatting, Full dose page data is isolated into template part and data portion, and respectively by corresponding full dose page data, template portion Divide, local cache is written in data portion.
In the step b1, first judge the part for whether having there are local cache in the page that need to load, if in the presence of if The full dose page data in local cache is preferentially loaded in step b2, parallel type is bridged in step c, meanwhile, there will be no this If the part of ground caching, there is no the part of ontology caching, passes through the network request page by network request page data Data.
Further include after the step b1
Step b31, the page data that responds after sending out request is analyzed, judge current template part with it is original Whether more masterplate part new change compared to enters step b32 if current template part has more new change, if current More new change is not present in template part, then enters step b33;
The step b32 includes
Step b321, page data is reanalysed, updated template part and data portion are isolated;
Step b322, corresponding full dose page data, template part, data portion are updated into local cache respectively;
Step b323, notice WebView carries out whole refreshing;
The step b33 includes
Step b331, original data portion in current data portion and local cache is compared, analyzes number According to difference section;
Step b332, by original data portion in current data portion update local cache, while by current number Full dose page data is merged into according to part and masterplate part, and updates original comprehensive page data in local cache;
Step b333, data difference part is adjusted back to WebView and carries out partial refresh.
Beneficial effects of the present invention:
The method that the present invention loads webpage, WebView is created, initialization, the ready first pass chains of WebKit and The second procedure chain parallel processing of loading page data, while being bridged by streaming after handling, NSUrlProtocol makes foster son by oneself When class loads data, sub-line journey is opened, constantly obtains data from memory stream, again return to WebKit kernels, WebView is rendered The page, the design have been based on the network connection loaded page of NSUrlSession while creating the preparations such as WebView Face data so that request opportunity is preferable, and loading velocity is accelerated, and promotes the application experience of user.
Description of the drawings
The specific implementation mode of the present invention is described further below in conjunction with the accompanying drawings.
Fig. 1 is the basic flow chart of the method for present invention load webpage.
Fig. 2 is the flow chart in the case where having local cache of the method for present invention load webpage.
Specific implementation mode
As shown in Figure 1 and Figure 2, the present invention promotes load webpage speed method, can be applied to the ends IOS and for loading H5 The equal pages, the method for loading webpage herein include the first pass chain and second procedure chain of parallel processing;
First pass chain includes the following steps:
The self-defined subclasses of NSUrlProtocol of a1, registration for intercepting WebView requests;
A2, it creates WebView and initializes;
A3, WebView initiate page request;
The self-defined subclass of a4, NSUrlProtocol intercepts the page request that WebView is sent out;
Second procedure chain includes the following steps:
B1, the primary network connection based on NSUrlSession of structure, according to the page request page data that need to be loaded;
B2, receiving step b1 send out the page data responded after request, generate memory stream;
It is bridged with streaming after step b2 after the step S4, and further includes step:
C, the self-defined subclass loading page data of NSUrlProtocol open sub-line journey, page number are obtained from memory stream According to, and return to WebKit kernels;
D, WebView renders the page according to page data.
Wherein, WebKit kernels, based on WebKit kernels come show the Wed pages WebView components, The self-defined subclass of NSUrlProtocol and the network connection based on NSUrlSession belong to browse net in intelligent terminal Conventional technology in network page field, basic boom, structure relationship, program are specifically write etc. not to be repeated herein, and is flowed For page data is produced memory stream in step b2, NSUrlProtocol is read out formula bridge joint in a stream in turn.
The design creates WebView, initialization, the ready first pass chains and loading page data of WebKit the Two flow chain parallel processings, while being bridged by streaming after handling, when the self-defined subclasses of NSUrlProtocol load data, open Opener thread constantly obtains data from memory stream, again returns to WebKit kernels, and WebView renders the page, and the design is creating While building the preparations such as WebView, the network connection loading page data of NSUrlSession are had been based on so that request Opportunity is preferable, and loading velocity is accelerated, and promotes the application experience of user.
To realize the most basic method of the design in above-mentioned first pass chain, second procedure chain, step c, step d, into One step, the design can add local cache, further include b21 after step b2, after receiving page data, will receive Full dose page data be written local cache.
As shown in Figure 2, wherein in step b1 after receiving full dose page data, according to page formatting to full dose page number According to being analyzed, full dose page data is isolated into template part and data portion, and respectively by the corresponding full dose page Local cache is written in data, template part, data portion.
After with local cache, the method for the design can also extend, based on step b1 to full dose page data Analysis mode and the mode of local cache is written, in loading page data next time, herein by new primary page number According to, template part, data portion be discussed as current full dose page data, template part, data portion.
In step b1, first judge the part for whether having there are local cache in the page that need to load, if in the presence of if in step The full dose page data in local cache is preferentially loaded in b2, parallel type is bridged in step c, meanwhile, there will be no local slow If the part deposited, there is no the part of ontology caching, passes through network request page data by network request page data.
Further include step b31 after the step b1, analyze sending out the page data responded after request, judges current Template part compared with original masterplate part whether more new change, if there is more new change in current template part, into Enter step b32, if more new change is not present in current template part, enters step b33;
The step b32 includes
Step b321, page data is reanalysed, updated template part and data portion are isolated;
Step b322, corresponding full dose page data, template part, data portion are updated into local cache respectively;
Step b323, notice WebView carries out whole refreshing;
The step b33 includes
Step b331, original data portion in current data portion and local cache is compared, analyzes number According to difference section;
Step b332, by original data portion in current data portion update local cache, while by current number Full dose page data is merged into according to part and masterplate part, and updates original comprehensive page data in local cache;
Step b333, data difference part is adjusted back to WebView and carries out partial refresh.
Under the network connection of NSUrlSession, after the page request page data that need to be loaded, server-side is rung The result answered is judged, if it find that template part is constant, is simply updated data portion, that just from which further follows that the difference of data Different part is adjusted back by JS and does Local hydrodynamic unit to WebView components;If template part changes, just by loading for the first time Logic, which executes, comes full dose refreshing webpage and update caching, and full dose page data herein can split into corresponding mould by analysis Plate part, data portion, corresponding template part, data portion can also obtain full dose page data by merging, in turn WebView is to carry out refreshing and partial refresh comprehensively to rendering the page after above-mentioned steps.
Occur the phenomenon that white screen for a long time when further avoiding page load, promotes user experience.
The foregoing is merely the preferred embodiments of the present invention, and the present invention is not limited to the above embodiments, as long as with Essentially identical means realize that the technical solution of the object of the invention belongs within protection scope of the present invention.

Claims (5)

1. a kind of method promoting load webpage speed, which is characterized in that the first pass chain including parallel processing and second Journey chain;
First pass chain includes the following steps:
The self-defined subclasses of NSUrlProtocol of a1, registration for intercepting WebView requests;
A2, it creates WebView and initializes;
A3, WebView initiate page request;
The self-defined subclass of a4, NSUrlProtocol intercepts the page request that WebView is sent out;
Second procedure chain includes the following steps:
B1, the primary network connection based on NSUrlSession of structure, according to the page request page data that need to be loaded;
B2, receiving step b1 send out the page data responded after request, generate memory stream;
It is bridged with streaming after step b2 after the step S4, and further includes step:
C, the self-defined subclass loading page data of NSUrlProtocol open sub-line journey, page data are obtained from memory stream, And return to WebKit kernels;
D, WebView renders the page according to page data.
2. a kind of method promoting load webpage speed according to claim 1, it is characterised in that:After step b2 also Including b21, after receiving page data, be written local cache.
3. a kind of method promoting load webpage speed according to claim 2, it is characterised in that:In the step b1 After receiving full dose page data, full dose page data is analyzed according to page formatting, full dose page data is detached into depanning Plate part and data portion, and it is respectively that corresponding full dose page data, template part, data portion write-in is local slow It deposits.
4. a kind of method promoting load webpage speed according to claim 3, it is characterised in that:In the step b1, The part for whether having there are local cache in the page that need to be loaded first is judged, if preferentially load is local slow in step b2 in the presence of if Full dose page data in depositing, parallel type are bridged in step c, meanwhile, there will be no the parts of local cache to be asked by network Page data is sought, if there is no the part of ontology caching, passes through network request page data.
5. a kind of method promoting load webpage speed according to claim 4, it is characterised in that:After the step b1 also Including
Step b31, it analyzes sending out the page data responded after request, judges current template part and original masterplate Whether more part new change compared to enters step b32, if current template if current template part has more new change More new change is not present in part, then enters step b33;
The step b32 includes
Step b321, page data is reanalysed, updated template part and data portion are isolated;
Step b322, corresponding full dose page data, template part, data portion are updated into local cache respectively;
Step b323, notice WebView carries out whole refreshing;
The step b33 includes
Step b331, original data portion in current data portion and local cache is compared, analyzes data difference Different part;
Step b332, by original data portion in current data portion update local cache, while by current data portion Divide and merge into full dose page data with masterplate part, and updates original comprehensive page data in local cache;
Step b333, data difference part is adjusted back to WebView and carries out partial refresh.
CN201810259605.0A 2018-03-27 2018-03-27 Method for increasing webpage loading speed Withdrawn CN108520031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810259605.0A CN108520031A (en) 2018-03-27 2018-03-27 Method for increasing webpage loading speed

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810259605.0A CN108520031A (en) 2018-03-27 2018-03-27 Method for increasing webpage loading speed

Publications (1)

Publication Number Publication Date
CN108520031A true CN108520031A (en) 2018-09-11

Family

ID=63434260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810259605.0A Withdrawn CN108520031A (en) 2018-03-27 2018-03-27 Method for increasing webpage loading speed

Country Status (1)

Country Link
CN (1) CN108520031A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582889A (en) * 2018-10-17 2019-04-05 平安普惠企业管理有限公司 Picture loading method, device, computer equipment and storage medium
CN109614563A (en) * 2018-12-05 2019-04-12 北京达佳互联信息技术有限公司 Show method, apparatus, equipment and the storage medium of webpage
CN109815427A (en) * 2018-12-14 2019-05-28 平安普惠企业管理有限公司 Show method, client application module, H5 module and the system of the H5 page
CN110209973A (en) * 2019-05-24 2019-09-06 厦门美柚信息科技有限公司 A kind of web game loading method and device
CN110321506A (en) * 2019-07-04 2019-10-11 广州小鹏汽车科技有限公司 Webpage data loading method, device, computer equipment and storage medium
CN110727478A (en) * 2019-10-16 2020-01-24 腾讯科技(深圳)有限公司 Method, device, equipment and medium for rendering page based on mixed mode
CN111026463A (en) * 2019-12-20 2020-04-17 深圳乐信软件技术有限公司 Page loading method, device, equipment and storage medium
CN114428922A (en) * 2022-01-24 2022-05-03 中国工商银行股份有限公司 Page loading method and device, terminal equipment and storage medium

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582889A (en) * 2018-10-17 2019-04-05 平安普惠企业管理有限公司 Picture loading method, device, computer equipment and storage medium
CN109614563A (en) * 2018-12-05 2019-04-12 北京达佳互联信息技术有限公司 Show method, apparatus, equipment and the storage medium of webpage
CN109614563B (en) * 2018-12-05 2021-06-08 北京达佳互联信息技术有限公司 Method, device and equipment for displaying webpage and storage medium
CN109815427A (en) * 2018-12-14 2019-05-28 平安普惠企业管理有限公司 Show method, client application module, H5 module and the system of the H5 page
CN110209973A (en) * 2019-05-24 2019-09-06 厦门美柚信息科技有限公司 A kind of web game loading method and device
CN110209973B (en) * 2019-05-24 2021-03-19 厦门美柚股份有限公司 Webpage game loading method and device
CN110321506A (en) * 2019-07-04 2019-10-11 广州小鹏汽车科技有限公司 Webpage data loading method, device, computer equipment and storage medium
CN110727478A (en) * 2019-10-16 2020-01-24 腾讯科技(深圳)有限公司 Method, device, equipment and medium for rendering page based on mixed mode
CN111026463A (en) * 2019-12-20 2020-04-17 深圳乐信软件技术有限公司 Page loading method, device, equipment and storage medium
CN111026463B (en) * 2019-12-20 2023-12-26 深圳乐信软件技术有限公司 Page loading method, device, equipment and storage medium
CN114428922A (en) * 2022-01-24 2022-05-03 中国工商银行股份有限公司 Page loading method and device, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108520031A (en) Method for increasing webpage loading speed
AU2017258180B2 (en) Method and system for developing and deploying data science transformations from a development computing environment into a production computing environment
US9420034B2 (en) Providing services to multiple tenants of an application
US6199046B1 (en) Method system and article of manufacture for performing real time currency conversion
CN112329945A (en) Model deployment and reasoning method and device
CN111158866A (en) Engine system and rendering method thereof
WO2019201340A1 (en) Processor core scheduling method and apparatus, terminal, and storage medium
CN109791562A (en) Interaction is applied after improving installation
CN105871911A (en) Service calling engine, method and system
WO2023197762A1 (en) Image rendering method and apparatus, electronic device, computer-readable storage medium, and computer program product
CN106919406A (en) A kind of desktop application component issue, update method and device
CN112965916B (en) Page testing method, page testing device, electronic equipment and readable storage medium
CN110442406B (en) Paging control data processing method, paging control and electronic equipment
CN110362375A (en) Display methods, device, equipment and the storage medium of desktop data
CN109819008A (en) A kind of method of server data migration, server and system with Data Migration function
CN104253830B (en) A kind of location Based service system of selection
CN110717992B (en) Method, apparatus, computer system and readable storage medium for scheduling model
Detragiache Technology diffusion and international income convergence
CN113596164A (en) Data access method, device, system, equipment and medium
CN111988368A (en) Data interaction system and interaction method
Eilemann et al. From big data to big displays high-performance visualization at blue brain
CN112988170B (en) Application display method and device
WO2023093885A1 (en) Cloud technology-based graphic program online development method and system, and related device
CN112330450B (en) Calculation power transaction processing method and device, node of block chain and storage medium
CN106776022A (en) A kind of system and method for optimizing game process CPU usage

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20180911

WW01 Invention patent application withdrawn after publication