CN103870259A - Method and device for data processing - Google Patents
Method and device for data processing Download PDFInfo
- Publication number
- CN103870259A CN103870259A CN201210543879.5A CN201210543879A CN103870259A CN 103870259 A CN103870259 A CN 103870259A CN 201210543879 A CN201210543879 A CN 201210543879A CN 103870259 A CN103870259 A CN 103870259A
- Authority
- CN
- China
- Prior art keywords
- data
- chained list
- data element
- array
- newly
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 25
- 238000003672 processing method Methods 0.000 claims description 21
- 239000002699 waste material Substances 0.000 abstract description 7
- 230000008569 process Effects 0.000 description 8
- 238000012217 deletion Methods 0.000 description 5
- 230000037430 deletion Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method and device for data processing and belongs to the field of computers. The method comprises the steps of obtaining a group of to-be-processed data, caching the to-be-processed data as an element chain table which comprises one or a plurality of data elements, and enabling the data elements to comprise respectively stored data; and adding the data elements in the element chain table when performing adding processing on the to-be-processed data. By caching the to-be-processed data as the element chain table and adding the data elements to the element chain table when the adding processing is performed on the to-be-processed data, the goal of reducing memory resource waste and improving processing efficiency is achieved.
Description
Technical field
The present invention relates to computer realm, particularly a kind of data processing method and device.
Background technology
JavaScript(is called for short JS) be a kind of conventional computerese, be usually used in Web browser.Browser based on JS can add and delete or random access processing the data that produce in browser use procedure.
In existing browser data disposal route, be a dynamic array by pending data buffer storage, browser can directly be accessed the data in this dynamic array.In addition, in the time that pending data exceed the current capacity of this dynamic array, browser can carry out dilatation to this dynamic array on the basis of existing capacity.Concrete, if initial capacity is r0, the capacity r after dilatation for the first time
1for 1.5*(r
0+ 1), the capacity after dilatation is for the second time r
2for 1.5*(r
1+ 1), by that analogy.When each dilatation, browser can a newly-built dynamic array, and by the data Replica in former dynamic array to newly-built dynamic array.
Realizing in process of the present invention, inventor finds that prior art at least exists following problem:
First, in existing data processing method, browser carries out dilatation to dynamic array according to a certain percentage, instead of carries out dilatation according to the actual amount of data of pending data, and the dynamic array after dilatation tends to available free capacity, waste memory source.Secondly, while dynamic array being carried out to dilatation at every turn, all need newly-built dynamic array and copy the data in former dynamic array, treatment effeciency is low.
Summary of the invention
In order to solve memory source waste and the low problem for the treatment of effeciency in prior art, the embodiment of the present invention provides a kind of data processing method and device.Described technical scheme is as follows:
On the one hand, provide a kind of data processing method, described method comprises:
Obtaining one group of pending data, is an element chained list by described pending data buffer storage, and described element chained list comprises one or more data element, includes the data of storage separately in described data element;
When described pending data are added to processing, in described element chained list, add data element.
Describedly in described element chained list, add data element, specifically comprise:
Newly-built one or more data element in described element chained list, and data to be added are write in described one or more newly-built data element.
Described method also comprises:
When described pending data are deleted to processing, the data element at data to be deleted place is deleted.
Described method also comprises:
When described pending data are carried out to random access, generate a continuous array according to described element chained list, and described array is carried out to random access.
In described each data element, also include the pointer for the buffer address of data element before and after indicating, described according to a continuous array of described element chained list generation, specifically comprise:
Obtain the data total amount of each data element storage in described element chained list;
The empty array that a newly-built capacity equates with described data total amount;
According to the pointer for the buffer address of data element before and after indicating in described each data element, the data of each data element storage in described element chained list are copied in described newly-built empty array one by one.
On the other hand, provide a kind of data processing equipment, described device comprises:
Data acquisition module, for obtaining one group of pending data;
Data cache module, is element chained list for the pending data buffer storage that described data acquisition module is obtained, and described element chained list comprises one or more data element, includes the data of storage separately in described data element;
Add module, while processing for described pending data are added, in described element chained list, add data element.
Described interpolation module, specifically for, newly-built one or more data element in described element chained list, and data to be added are write in described one or more newly-built data element.
Described device also comprises:
Removing module, while processing, deletes the data element at data to be deleted place for described pending data are deleted.
Described device also comprises:
Array generation module, when described pending data are carried out to random access, generates a continuous array according to described element chained list;
Random access module, carries out random access for the array that described array generation module is generated.
In described each data element, also include the pointer for the buffer address of data element before and after indicating, described array generation module, specifically comprises:
Acquiring unit, for obtaining the data total amount of the each data element storage of described element chained list;
Newly-built unit, the empty array equating with described data total amount for a newly-built capacity;
Data copy cell, for the pointer for the buffer address of data element before and after indicating according to described each data element, copies to the data of each data element storage in described element chained list in described newly-built empty array one by one.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is:
By being element chained list by pending data buffer storage, and add while processing treating deal with data, in element chained list, add data element, reached the waste of minimizing memory source, improve the object for the treatment of effeciency.
Brief description of the drawings
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing of required use during embodiment is described is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the method flow diagram of the data processing method that provides of the embodiment of the present invention one;
Fig. 2 is the method flow diagram of the data processing method that provides of the embodiment of the present invention two;
Fig. 3 is the structural representation of the element chained list that provides of the embodiment of the present invention two;
Fig. 4 is the structural representation of the array that provides of the embodiment of the present invention two;
Fig. 5 is a kind of structure drawing of device of the data processing equipment that provides of the embodiment of the present invention three;
Fig. 6 is the another kind of structure drawing of device of the data processing equipment that provides of the embodiment of the present invention three.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment mono-
Refer to Fig. 1, it shows the method flow diagram of the data processing method that the embodiment of the present invention one provides, and the method can be applied in the browser based on JS adds and delete or access process data.This data processing method can comprise:
In sum, the data processing method that the embodiment of the present invention provides, by being element chained list by pending data buffer storage, and treat deal with data add process time, in element chained list, add data element, reached the waste of minimizing memory source, improve the object for the treatment of effeciency.
Embodiment bis-
For the data processing method that embodiment mono-is provided is described further, refer to Fig. 2, the method flow diagram that it shows the data processing method that the embodiment of the present invention two provides, can be applied in the browser based on JS data are added and deleted or access process.This data processing method can comprise:
Wherein, browser can be a browser based on JS, and the pending data of obtaining can be data that have fixed data structure, such as one group of Array data.
Browser is an element chained list by the data buffer storage of Array structure, wherein, an element chained list can comprise a linked list head and one or more data element, the memory address of each data element can be discontinuous, in each data element, store the data that this data element is corresponding, and for the pointer of the buffer address of data element before and after indicating.Concrete, refer to Fig. 3, it shows the structural drawing of the element chained list that the embodiment of the present invention provides, wherein, head is the linked list head of element chained list, in linked list head, include the memory address of first data element, the data data storing in the buffer address that comprises a rear data element in first data element and this data element, in last data element, comprise the data data storing in the buffer address of previous data element and this data element, in remaining data element, include the buffer address of previous data element, the data data storing in the buffer address of a rear data element and this data element.
When needs treat deal with data add process time, browser is newly-built one or more data element in element chained list, and data to be added are write in one or more newly-built data element.Concrete, browser can be that one or more groups continuous memory address of data allocations to be added is as one or more empty data element, and data to be added are stored in this one or more empty data element into the pointer of the buffer address of data element before and after being also useful on of simultaneously adding indicates.Browser is connected to one or more newly-generated data element in original element chained list after last data element, and the buffer address of first newly-generated data element is added in last data element in original element chained list.
Delete while processing when treating deal with data, the data element at data to be deleted place is deleted.Concrete, when browser is deleted data, can delete according to data element, once at least delete a data element.Meanwhile, browser, after deleting data element, also needs the pointer in deleted data element last data element and a rear data element to upgrade.
When browser need to be treated deal with data and carries out random access, first obtain the data total amount of each data element storage in element chained list; The empty array that a newly-built capacity equates with data total amount; According to the pointer for the buffer address of data element before and after indicating in each data element, the data of each data element storage in element chained list are copied in newly-built empty array one by one.
Concrete, browser can obtain the data total amount of storing in this element chained list from the linked list head of element chained list, also can obtain data total amount according to the data volume in each data element.After browser obtains the data total amount of storing in this element chained list, one group of continuous memory address of new distribution, and according to the pointer for the buffer address of data element before and after indicating in each data element, one by one by the data Replica in each data element in newly assigned memory address, to generate the array of being convenient to browser and directly carrying out random access.Concrete structure of arrays schematic diagram shown in Figure 4.
It should be noted that, if browser is carrying out after random access the array generating for the first time, again the data element in element chained list is added to deletion action, and in the time after this for the second time array being carried out to random access, also need to, according to adding deletion action element chained list afterwards, regenerate the array of user's random access.
Process and access process generally can not carried out because browser adds to delete to data simultaneously, and be first to add deletion processing most time, then the processing that conducts interviews.Therefore, the method that the embodiment of the present invention one provides, first so that add or delete the pending data of element chain sheet form buffer memory of processing, so that treating deal with data, browser adds processing, in the time that needs are treated deal with data and are conducted interviews, generate and be convenient to the directly array of access according to the element chained list of buffer memory again, carry out random access processing so that browser is treated deal with data.
In sum, the data processing method that the embodiment of the present invention two provides, by being element chained list by pending data buffer storage, add deletion processing to treat deal with data, and in the time treating deal with data and conduct interviews, generate and be convenient to the directly array of access according to element chained list again, reached the waste of minimizing memory source, improve the object for the treatment of effeciency.
Embodiment tri-
For the data processing method that above-described embodiment is provided is described in more detail, refer to Fig. 5, it shows a kind of structure drawing of device of the data processing equipment that the embodiment of the present invention three provides, and this data processing equipment can be applied in the web browser based on JS language.This data processing equipment can comprise:
Add module 503, for adding when processing treating deal with data, in this element chained list, add data element.
Wherein, add module 503, specifically for adding when processing when treating deal with data, newly-built one or more data element in element chained list, and data to be added are write in one or more newly-built data element;
Treat deal with data when needs and add while processing, add module 503 newly-built one or more data element in element chained list, and data to be added are write in one or more newly-built data element.Concrete, adding module 503 can be that one or more groups continuous memory address of data allocations to be added is as one or more empty data element, and data to be added are stored in this one or more empty data element into the pointer of the buffer address of data element before and after being also useful on of simultaneously adding indicates.Add module 503 one or more newly-generated data element is connected in original element chained list after last data element, and the buffer address of first newly-generated data element is added in last data element in original element chained list.
Refer to Fig. 6, it shows the another kind of structure drawing of device of the data processing equipment that the embodiment of the present invention three provides, and wherein, this data processing equipment also comprises:
Removing module 504, while processing, deletes the data element at data to be deleted place for these pending data are deleted.
Delete while processing when treating deal with data, the data element at data to be deleted place is deleted.Concrete, when removing module 504 is deleted data, can delete according to data element, once at least delete a data element.Meanwhile, removing module 504, after deleting data element, also needs the pointer in deleted data element last data element and a rear data element to upgrade.
In addition, this device also comprises:
In addition, also include the pointer for the buffer address of data element before and after indicating in each data element, wherein, array generation module 505, specifically comprises:
Acquiring unit 505a, for obtaining the data total amount of the each data element storage of element chained list;
Newly-built unit 505b, the empty array equating with data total amount for a newly-built capacity;
Data copy cell 505c, for the pointer for the buffer address of data element before and after indicating according to each data element, copies to the data of each data element storage in element chained list in newly-built empty array one by one.
In sum, the data processing equipment that the embodiment of the present invention three provides, by being element chained list by pending data buffer storage, add deletion processing to treat deal with data, and in the time treating deal with data and conduct interviews, generate and be convenient to the directly array of access according to element chained list again, reached the waste of minimizing memory source, improve the object for the treatment of effeciency.
It should be noted that: the data processing equipment that above-described embodiment provides is in the time of deal with data, only be illustrated with the division of above-mentioned each functional module, in practical application, can above-mentioned functions be distributed and completed by different functional modules as required, be divided into different functional modules by the inner structure of device, to complete all or part of function described above.In addition, the data processing equipment that above-described embodiment provides and data processing method embodiment belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step that realizes above-described embodiment can complete by hardware, also can carry out the hardware that instruction is relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be ROM (read-only memory), disk or CD etc.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any amendment of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.
Claims (10)
1. a data processing method, is characterized in that, described method comprises:
Obtaining one group of pending data, is an element chained list by described pending data buffer storage, and described element chained list comprises one or more data element, includes the data of storage separately in described data element;
When described pending data are added to processing, in described element chained list, add data element.
2. data processing method according to claim 1, is characterized in that, describedly in described element chained list, adds data element, specifically comprises:
Newly-built one or more data element in described element chained list, and data to be added are write in described one or more newly-built data element.
3. data processing method according to claim 1, is characterized in that, described method also comprises:
When described pending data are deleted to processing, the data element at data to be deleted place is deleted.
4. according to the arbitrary described data processing method of claims 1 to 3, it is characterized in that, described method also comprises:
When described pending data are carried out to random access, generate a continuous array according to described element chained list, and described array is carried out to random access.
5. data processing method according to claim 4, is characterized in that, also includes the pointer for the buffer address of data element before and after indicating in described each data element, described according to a continuous array of described element chained list generation, specifically comprises:
Obtain the data total amount of each data element storage in described element chained list;
The empty array that a newly-built capacity equates with described data total amount;
According to the pointer for the buffer address of data element before and after indicating in described each data element, the data of each data element storage in described element chained list are copied in described newly-built empty array one by one.
6. a data processing equipment, is characterized in that, described device comprises:
Data acquisition module, for obtaining one group of pending data;
Data cache module, is element chained list for the pending data buffer storage that described data acquisition module is obtained, and described element chained list comprises one or more data element, includes the data of storage separately in described data element;
Add module, while processing for described pending data are added, in described element chained list, add data element.
7. data processing equipment according to claim 6, is characterized in that, described interpolation module, specifically for, newly-built one or more data element in described element chained list, and data to be added are write in described one or more newly-built data element.
8. data processing equipment according to claim 6, is characterized in that, described device also comprises:
Removing module, while processing, deletes the data element at data to be deleted place for described pending data are deleted.
9. according to the arbitrary described data processing equipment of claim 6 to 8, it is characterized in that, described device also comprises:
Array generation module, when described pending data are carried out to random access, generates a continuous array according to described element chained list;
Random access module, carries out random access for the array that described array generation module is generated.
10. data processing equipment according to claim 9, is characterized in that, also includes the pointer for the buffer address of data element before and after indicating in described each data element, and described array generation module, specifically comprises:
Acquiring unit, for obtaining the data total amount of the each data element storage of described element chained list;
Newly-built unit, the empty array equating with described data total amount for a newly-built capacity;
Data copy cell, for the pointer for the buffer address of data element before and after indicating according to described each data element, copies to the data of each data element storage in described element chained list in described newly-built empty array one by one.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210543879.5A CN103870259A (en) | 2012-12-14 | 2012-12-14 | Method and device for data processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210543879.5A CN103870259A (en) | 2012-12-14 | 2012-12-14 | Method and device for data processing |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103870259A true CN103870259A (en) | 2014-06-18 |
Family
ID=50908832
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210543879.5A Pending CN103870259A (en) | 2012-12-14 | 2012-12-14 | Method and device for data processing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103870259A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104458261A (en) * | 2014-11-06 | 2015-03-25 | 上海汽车集团股份有限公司 | Multi-interface engine measurement and control system data queue processing method |
WO2018064962A1 (en) * | 2016-10-08 | 2018-04-12 | 腾讯科技(深圳)有限公司 | Data storage method, electronic device and computer non-volatile storage medium |
CN109597683A (en) * | 2018-08-23 | 2019-04-09 | 北京字节跳动网络技术有限公司 | EMS memory management process, device, equipment and storage medium |
WO2024239835A1 (en) * | 2023-05-23 | 2024-11-28 | 阿里云计算有限公司 | Method and apparatus for recording memory state, and computer device and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6389421B1 (en) * | 1997-12-11 | 2002-05-14 | International Business Machines Corporation | Handling processor-intensive operations in a data processing system |
CN1378143A (en) * | 2001-03-30 | 2002-11-06 | 深圳市中兴通讯股份有限公司 | Method for realizing quick data transfer |
US7194679B1 (en) * | 1998-10-20 | 2007-03-20 | International Business Machines Corporation | Web-based file review system utilizing source and comment files |
CN101276334A (en) * | 2007-03-29 | 2008-10-01 | 上海新跃仪表厂 | Linked list implementing method for quickly searching data |
CN102075570A (en) * | 2010-12-31 | 2011-05-25 | 南京中兴特种软件有限责任公司 | Method for implementing HTTP (hyper text transport protocol) message caching mechanism based on keywords |
CN102163231A (en) * | 2011-04-13 | 2011-08-24 | 浪潮(北京)电子信息产业有限公司 | Method and device for data collection |
CN102520955A (en) * | 2011-12-19 | 2012-06-27 | 浪潮电子信息产业股份有限公司 | Method for removing duplication in producer and consumer optimization problems based on LRU (least recently used) algorithm |
CN102541953A (en) * | 2010-12-29 | 2012-07-04 | 北大方正集团有限公司 | Method and system for displaying tree-structure network data |
CN102760080A (en) * | 2011-04-26 | 2012-10-31 | 腾讯科技(深圳)有限公司 | Memory management method and device |
-
2012
- 2012-12-14 CN CN201210543879.5A patent/CN103870259A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6389421B1 (en) * | 1997-12-11 | 2002-05-14 | International Business Machines Corporation | Handling processor-intensive operations in a data processing system |
US7194679B1 (en) * | 1998-10-20 | 2007-03-20 | International Business Machines Corporation | Web-based file review system utilizing source and comment files |
CN1378143A (en) * | 2001-03-30 | 2002-11-06 | 深圳市中兴通讯股份有限公司 | Method for realizing quick data transfer |
CN101276334A (en) * | 2007-03-29 | 2008-10-01 | 上海新跃仪表厂 | Linked list implementing method for quickly searching data |
CN102541953A (en) * | 2010-12-29 | 2012-07-04 | 北大方正集团有限公司 | Method and system for displaying tree-structure network data |
CN102075570A (en) * | 2010-12-31 | 2011-05-25 | 南京中兴特种软件有限责任公司 | Method for implementing HTTP (hyper text transport protocol) message caching mechanism based on keywords |
CN102163231A (en) * | 2011-04-13 | 2011-08-24 | 浪潮(北京)电子信息产业有限公司 | Method and device for data collection |
CN102760080A (en) * | 2011-04-26 | 2012-10-31 | 腾讯科技(深圳)有限公司 | Memory management method and device |
CN102520955A (en) * | 2011-12-19 | 2012-06-27 | 浪潮电子信息产业股份有限公司 | Method for removing duplication in producer and consumer optimization problems based on LRU (least recently used) algorithm |
Non-Patent Citations (1)
Title |
---|
王秀贵 等: "《C语言程序设计教程》", 31 March 2007, 中国铁道出版社 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104458261A (en) * | 2014-11-06 | 2015-03-25 | 上海汽车集团股份有限公司 | Multi-interface engine measurement and control system data queue processing method |
WO2018064962A1 (en) * | 2016-10-08 | 2018-04-12 | 腾讯科技(深圳)有限公司 | Data storage method, electronic device and computer non-volatile storage medium |
US10642515B2 (en) | 2016-10-08 | 2020-05-05 | Tencent Technology (Shenzhen) Company Limited | Data storage method, electronic device, and computer non-volatile storage medium |
CN109597683A (en) * | 2018-08-23 | 2019-04-09 | 北京字节跳动网络技术有限公司 | EMS memory management process, device, equipment and storage medium |
WO2024239835A1 (en) * | 2023-05-23 | 2024-11-28 | 阿里云计算有限公司 | Method and apparatus for recording memory state, and computer device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103098014B (en) | Storage system | |
WO2017020637A1 (en) | Task allocation method and task allocation apparatus for distributed data calculation | |
EP3196767B1 (en) | Method for writing data into flash memory device, flash memory device and storage system | |
CN103870259A (en) | Method and device for data processing | |
CN104052824B (en) | Distributed caching method and system | |
KR102385983B1 (en) | OWL-Horst ontology inference method and apparatus using distributed table structure in cloud computing environment | |
CN106855861A (en) | File merging method and device and electronic equipment | |
US20240086332A1 (en) | Data processing method and system, device, and medium | |
CN110399096B (en) | Method, device and equipment for deduplication of distributed file system metadata cache | |
CN101763433B (en) | Data storage system and method | |
WO2024245159A1 (en) | Data writing method and device for solid-state disk, and solid-state disk | |
CN112035207A (en) | Database-based dynamic loading method and device for page menu | |
US8380962B2 (en) | Systems and methods for efficient sequential logging on caching-enabled storage devices | |
US11429299B2 (en) | System and method for managing conversion of low-locality data into high-locality data | |
US10083117B2 (en) | Filtering write request sequences | |
CN103678577A (en) | Method and device for updating data | |
CN110377877B (en) | A data processing method, device, equipment and storage medium | |
CN103902471A (en) | Data cache processing method and device | |
CN119474631A (en) | A method and device for accelerating data processing of sparse matrix multiplication operator | |
CN101566933B (en) | Method and device for configurating cache and electronic equipment and data read-write equipment | |
CN102541869B (en) | The method and apparatus of write file | |
CN103530239A (en) | Method for improving performance of communication server by using memory pool | |
CN113821173B (en) | Data storage method, device, equipment and computer readable storage medium | |
US10198209B2 (en) | Memory storage recycling | |
CN110460634A (en) | Edge Computing Consensus Request Management Method and System |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140618 |
|
RJ01 | Rejection of invention patent application after publication |