SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Downloaden Sie, um offline zu lesen
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
DOI : 10.5121/ijpla.2013.3201 1
A FAST METHOD FOR IMPLEMENTATION OF THE
PROPERTY LISTS IN PROGRAMMING LANGUAGES
Hassan Rashidi1
1
Department of Electrical, Computer and IT Engineering, Islamic Azad University,
Qazvin Branch, Iran
hrashidi@qiau.ac.ir;hrashi@gmail.com
ABSTRACT
One of the major challenges in programming languages is to support different data structures and their
variations in both static and dynamic aspects. One of the these data structures is the property list which
applications use it as a convenient way to store, organize, and access standard types of data. In this paper,
the standards methods for implementation of the Property Lists, including the Static Array, Link List, Hash
and Tree are reviewed. Then an efficient method to implement the property list is presented. The
experimental results shows that our method is fast compared with the existing methods.
KEYWORDS
Programming Languages, Property List, Static Array, Link List, Set, Hash, Tree.
1. INTRODUCTION
Many applications and databases require some mechanisms for storing variable-size data objects
of information in some situations [1]. A variable-size data objects is one in which the number of
components in an object may change dynamically during program execution. Some of the major
types of variable-size data structures are list, list structure, stack, queue, tree, directed graph and
property list.
We focus on the property list, which is a list of alternating names and values. As a formal
definition for the property list in the standard textbook [1], a record with a varying number of
components is termed as property list if the number of components may vary without restriction.
In a property list, both the component names (field names) and their values must be stored. Each
field name is termed a property name; the corresponding value of the field is the property value.
A property list is also a structured data representation used by Cocoa and Core Foundation [2] as
a convenient way to store, organize, and access different types of data. The property list is natural
to use when the number and type of components in an object are not known in advance. Property
List data structure supports many real-time applications when they read some data from an input
device or change attributes of objects during program execution.
A common representation for a property list is as an ordinary linked list, with the property names
and their values alternating in a single long sequence, as illustrated in Figure 1. In this Figure, the
odd number items are property names, and the even are property values. There are three
commands to process a property list:
• Inserting a new element to the list: When a new property is inserted in the property list,
two components are inserted: the property name and its value.
• Removing an element from the list: To remove a particular property value (e.g., the value
for the ‘Name’ property in Figure 1), the list is searched, looking only at the property
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
2
names, until the desired property is found. A pair of component is then deleted from the
list.
• Finding a value in the list: To select a particular property value (e.g., the value for the
‘Age’ property in Figure 1), the list is searched, looking only at the property names, until
the desired property is found. The next list component is then the value for that property.
Figure 1. A storage representation of a Property List
The Property lists are used extensively by applications and other software on Mac OS X and iOS
[2]. For example, the Mac OS X Finder (through bundles) uses property lists to store file and
directory attributes. Applications on iOS use property lists in their Settings bundle to define the
list of options displayed to users.
The Property list has a simple XML format, designed by Apple for OSX as a format for storing
lists of key-value pairs (see [3]-[4]). In this operation system, most applications store their
Preferences as property list files. The property-list programming interfaces for Cocoa and Core
Foundation allow the user to convert hierarchically structured combinations of these basic types
of objects to and from standard XML. The user can save the XML data to disk and later use it to
reconstruct the original objects.
The Property lists are not part of the LISP language, but are an abstraction of common list
patterns and usages, and are often defined as LISP library functions. Each item in a list is tagged
with a name preceding the item like ( n1 val1 n2 val2 ... nk valk ). In this list ni is the property
name of ith
element and vali is the property value of ith
element.
This paper presents a fast method for implementation of the Property List in programming
languages. Section 2 makes a literature review over the related works in implementation of the
property lists and described the four standards methods. Section 3 presents the detail of the
method and makes a comparison on the methods in the main features as well as their
complexities. Section 4 is dedicated to some experimental results. This section makes a
‘Salary’
Property List
‘Name’
Pratt
‘Age’
61
44000
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
3
comparison between the times required to perform the operations on the property lists and derives
the observations in practise. Section 5 is considered for summary and conclusion.
2. THE RELATED WORK
The Property lists organize data into named values and lists of values using several object types.
This type of data structure gives the user the means to produce data that is meaningfully
structured, transportable, storable, and accessible, but still as efficient as possible. In this section,
the standards existing methods for implementation of Property List are reviewed.
2.1. Link list Method
The first choice for implementation of property list is link list. For situations where a user needs
to store small amounts of persistent data, for example less than a few hundred kilobytes, property
lists offer a uniform and convenient means of organizing, storing, and accessing the data. In these
situations, the simplest property-list implementation is a linked list (like Figure 1). The users can
either have the alternating elements be the keys and values (LISP does this), or they can have
each element be a structure containing pointers to the key and value. The linked list
implementation is appropriate when the users:
• are just using the pattern to allow user annotations on object instances.
• don't expect many such annotations on any given instance.
• are not incorporating inheritance, serialization or meta-properties into their use of the
pattern.
Logically a property list is an unordered set, not a sequential list, but when the set size is small
enough a linked list can yield the best performance. The performance of the link list is O(N), so
for long property lists the performance can deteriorate rapidly.
If the user needs a way to store large complex graphs of objects, objects not supported by the
property-list architecture, or objects whose mutability settings must be retained, use Archiving
and Serializations[2]. Archiving and serializations are two ways in which the user can create
architecture-independent byte streams of hierarchical data. Byte streams can then be written to a
file or transmitted to another process, perhaps over a network. When the byte stream is decoded,
the hierarchy is regenerated. Archives provide a detailed record of a collection of interrelated
objects and values. Serializations record only the simple hierarchy of property-list values.
2.2. Static Array Method
The simplest method to implement the property list is the use of fast static arrays with empty
slots. In this method, a large array with a specified size for elements is allocated statically, from
beginning to the end of execution. For each component, we have to consider a couple of slots
(words). The first one is for the component’s name and the second one for component’s value.
When the software wants to insert a new element, the first empty slot is selected for the position
of insertion. So we have to search to find an empty sot. To remove a particular property value
(e.g., the value for the ‘Name’ property in Figure 1), the static array is searched, looking only at
the property names, until the desired property is found. After deletion, the pair of slots is marked
as the hole/empty slots in the array.
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
4
2.3. Hash Method
The next most common implementation method is a hash-table, which yields amortized constant-
time on the operations of finding, inserting and removing for a given list, albeit at the cost of
more memory overhead and a higher fixed per-access cost, i.e. the cost of the hash function.
When a confliction occurs on inserting a new element in the list, the solutions of Rehashing,
Sequential Search and Bucketing [1] may be used.
In most systems, a hash-table imposes too much overhead when objects are expected to have only
a handful of properties, up to perhaps two or three dozen [6]. A common solution is to use a
hybrid model, in which the property list begins life as a simple array or linked list, and when it
crosses some predefined threshold (perhaps 40 to 50 items), the properties are moved into a hash-
table. So if we need a tolerant constant-time on access an item and want to maintain the insertion
order, we can't do better than a LinkedHashMap [6], a truly wonderful data structure. Java 6.0
implemented this solution. The complexity of this method is O(1). However, the costs of hash-
function and its overheads for solving confliction are inevitable.
2.4 Binary Tree Method
The 4th
method for implementation of property list is binary tree. If a language needs to impose a
sort order on property names, it must use an ordered-map implementation, typically an ordered
binary tree such as a splay tree or red/black tree (see [5] and [6]). A splay tree can be a good
choice because of the low fixed overhead for insertion, lookup and deletion operations, but with
the tradeoff that its theoretical worst-case performance is that of a linked list. A splay tree can be
especially useful when properties are not always accessed uniformly. If a small subset M of an
object's N properties are accessed most often, the amortized performance becomes O(log M),
making it a bit like an Least Recently Used (LRU) cache [2].
3. OUR METHOD- THE SET
A set is a data object containing and unordered collection of distinct values. In contract, a list is
an ordered collection of values, some of which may be repeated. The basic operations on sets are:
(a) Search or Lookup a data value in a set, (b) Insertion and Deletion of single values, and (c)
Union, Intersection, and Difference of Sets. This section presents a new and fast method for
implementation of the property lists.
In some situations, the property-list architecture may prove insufficient [2] and inefficient [9].
Our method for efficient implementation of property list is to present it as a set rather than a list
because elements are accessed randomly by subscript (attribute name) rather than sequentially., a
root property-list object is at the top of this hierarchy with a couple of pointers like Figure 2.
Figure 2. Representation of a property list object
In this method, we define a data structure like Table 1, consisting of SetContents to store the
contents and Pointers to ith
element. We make OR operation together all the properties in the set
Property List
Pointer to Table1
Pointer to Table2
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
5
and store this value in SetContents. The number of elements in the property list is variable with a
limit on the maximum. For a 32-bit wordsize of memory, there will be 32 such pointers. The
names are stored in a global table like Table 2 with a bit value, representing its position in the set.
If a machine has a 32-bit word size, then up to 32 properties can be stored, with bit values of: 1,
10, 100, 1000, and so on. The Bit Strings are shown for clarity; i.e. they can be removed
practically because they are in
(n=0, 1, 2,.., 31) respectively. The commands to process the
property list in this method are as follows:
• On lookup operation, we check if the bit string of the property name requested AND
SetContents = 0, then the property is not defined in the set. If the value is 1, then the bit
position defines the location containing a pointer to its attribute value.
• When a new element is to be inserted in the list, we must make a lookup as above. If the
property name is in the list, duplication is not possible. If the result of the lookup is negative,
the property name is put into an empty position in the Table 2. Then, we make OR operation
the SetContents with the corresponding bit string of the property name. After that the
corresponding Printer to the property value is set in Table1.
• When an existing element is to be removed from the list, we must make a lookup again. If
the result of the lookup is positive, then we make an AND operation of SetContents with
00000..00 and store the result in SetContents. After that the memory for property name and
property vale are freed and they set to Null in Tables 1 and 2. If the result of the lookup is
negative (The result of 0), the element requested doesn’t exist in the list.
Table 1. The Data Structure for the method
SetContents
Pointer to Property Value1
Pointer to Property Value2
……….
……….
Pointer to Property Value32
Table 2. A Global Table with a bit string, representing the position of each property value
Bit String
Pointers to
Property Name
00…..01
00…..10
………
………
10…..00
Since the property lists are based on an abstraction for expressing simple hierarchies of data, they
can support the application programs. Some types are for primitive values and others are for
containers of values. The primitive types are strings, numbers, binary data, dates, and boolean
values. The containers are arrays and dictionaries. The arrays are indexed collections of values
and the dictionaries are collections of values each identified by a key. The containers can contain
other containers as well as the primitive types. Thus the user might have an array of dictionaries,
and each dictionary might contain other arrays and dictionaries, as well as the primitive types. A
root property-list object is at the top of this hierarchy, and in almost all cases is a dictionary or an
array like Figure 3. Note, however, that a root property-list object does not have to be a dictionary
or array; for example, the user could have a single string, number, or date, and that primitive
value by itself can constitute an array or a dictionary.
Property Name1
Property Name2
Property Name32
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
6
The Property list is extensively used in Markup Languages. From the basic abstraction, languages
derive both a static representation of the property-list data and a dynamic (runtime) representation
of the property list [2]. The static representation of a property list, which is used for storage, can
be either XML or binary data. The binary version is a more compact form of the XML property
list. In XML, each type is represented by a certain element. The runtime representation of a
property list is based on objects corresponding to the abstract types. Both he static and dynamic
representation can use our implementation.
Figure 3. An array or dictionary of collections of values
The property lists are also used to define the SQL Queries in Database Management Systems and
JDBC2 Components [8]. The method presented here can by used in these systems and can create
more effective Dynamic Data Object.
The performance of this method for all operations is O(1). On insertion and deletion operation of
an element, although the performance of this method is as the same as the hash-function, it
benefits from the lookup operation and practically outperforms the hash because of no overheads.
Table 3 makes a summary on the main features and performance of the five methods discussed in
this paper. Although the Static Array is simple to implementations, the complexities of the
operations are higher. In the Link List method, the property list is presented as an unordered set
and has a lower difficulty for implementation. After that, the hash and binary tree are with a high
and medium difficulty for implementation, respectively. Both methods have some overheads in
run-time during the operations. As shown in the table, our method has no overheads on operations
and its implementation is easy.
Table 3. A comparison among the methods for implementation of property lists
Methods Main Features
Complexity of Operations
Lookup Insertion Deletion
Link List
An unordered set, Low
difficulty to implement
O(N) O(1) O(N)
Hash
High fixed overhead, High
difficulty to implement
O(1) O(1) O(1)
Valuei1
Valuei2
Valuein
Pointer from
Table 1
Dictionary
Number of Entries
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
7
Binary Tree
Low fixed overhead, Medium
difficulty to implement
O(Log N) O(Log N) O(Log N)
Static Array
Simple to implement, waste
of memory
O(N) O(N) O(N)
Our Method
(Set)
No overhead, Easy to
implement
O(1) O(1) O(1)
4. SOME EXPERIMENTAL RESULTS
In this section, several experiments are run to compare the standard algorithms and the method
presented in this paper. The software was implemented in Borland C++ and then was run to
compare the time required to perform several operations on a GenuineIntel 2.599 GHz PC with 1
GMB RAM on Windows XP. Figure 4 shows the main snapshot of our software.
Figure 4. The main snapshot of the software
The maximum size in the property list is assumed large up to 32 components. At the initial time,
between 25 and 29 components are inserted into the property list so that we can run three
operations in the same kinds. The length of Name component in the property lists is limited to 32
characters. In the three operations (Insert, Delete and LookUp), the position of insertion, the
elements to be Deleted and Looked-Up are selected randomly.
In the hash implementation, we used the following algorithm for hash function: (a) Multiply a and
b as the values of a member in the set, stored into two sequential words, giving c (two-word
product); (b) add together the two words of c, giving one value d; (c) Square d, giving e; and (d)
Extract the centre 32 bits of e, giving Ix as the hash index. When we got into conflict, a couple of
algorithms, namely Sequential Scan and Budgeting [1], are executed in order. If the first one
could not solve the problem, the second one is executed.
At the first stage, we ran the software for each single operation Insert, Delete and LookUp and
calculated the required time for the operations (see Figure 4). In this stage, the time required to
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
8
perform each operation was the same. In the second stage, we write scripts of three operations in
various combinations and ran the software. In this stage, we got slightly different times required
to perform the scripts. The results of this stage are collected in the Table 4.
Table 4. The time required (Micro Second) to perform the operation scripts
Row Operations
Methods
Hash
Binary
Tree
Link
List
Static
Array
Our
Method
(Set)
1 Insert-LookUp-Delete (ILD) 0.09 0.1 0.15 0.18 0.07
2 Insert-Delete-LookUp (IDL) 0.09 0.15 0.21 0.2 0.13
3 Lookup-Insert-Delete (LID) 0.09 0.14 0.17 0.17 0.14
4 LookUp-Delete-Insert (LDI) 0.12 0.2 0.18 0.19 0.08
5 Delete-Insert-LookUp (DIL) 0.09 0.17 0.12 0.18 0.08
6 Delete-LookUp-Insert (DLI) 0.1 0.2 0.22 0.18 0.07
7 Insert-Insert-Insert (III) 0.09 0.1 0.14 0.11 0.07
8 Insert-Insert-LookUp (IIL) 0.14 0.18 0.15 0.15 0.11
9 Insert-Insert-Delete (IID) 0.08 0.1 0.12 0.17 0.09
10 Delete-Delete-Delete (DDD) 0.11 0.19 0.14 0.23 0.08
11 Delete-Delete-Insert (DDI) 0.1 0.12 0.15 0.17 0.12
12 Delete-Delete-LookUp (DDL) 0.09 0.12 0.15 0.23 0.1
13 LookUp-LookUp-LookUp (LLL) 0.12 0.19 0.13 0.15 0.06
14 Lookup-LookUp-Delete (LLD) 0.07 0.1 0.19 0.1 0.09
15 LookUp-LookUp-Insert (LLI) 0.06 0.18 0.18 0.14 0.07
The Average Time 0.096 0.149 0.160 0.170 0.091
Figure 5. A comparison of the time required to perform the operations
From the information in the Table-4 and Figure-5, we got the following observations:
• Observation-1: The average time required to perform the operations in Static Array and
Link are longer than that of the others. These methods have approximately the same
average time. This observation is consistent with the results in Table 3.
International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013
9
• Observation-2: After the Link List and Static Array methods, the Binary Tree has the
smallest average time required to do the operations. The average time required to perform
the operations in Hash Implementation is shorter than that of the Binary Tree, but it is
slightly shorter than that of the Set method.
• Observation-3: The average time required to perform the operations in Hash and Set
methods is almost the same. The statistical F-test done shows that the differences
between our method and others are not significant in the mean value. We believe that the
overhead for handling conflict operations was not significant in the operations.
5 SUMMARY AND CONCLUSION
Basic differences among the languages refer to the types of data allowed, in the types operations
available, and in the mechanisms provided for the implementation. Modern high programming
languages need some data structures and their variations in both static and dynamic aspects. In
this paper, the standards methods for implementation Property List as Static Array, Link List,
Tree and Hash are reviewed. Then a method to implement the property list as Set was presented.
The method proposed has more efficiency than the existing methods. In the construction of large
application programs, the programmer is almost inevitably concerned with the design and
implementation of new data types. The method presented in this paper for implementation of
Property List, supports the users so that they can have more flexible and effective dynamic data
objects. It can be used in both, at programmer and programming languages levels. For further
research, some fast methods could be invented so that some values (names) in a property list have
more than one name (value).
REFERENCES
[1] Pratt, T.W., Zelkowitz, M., (2001), Programming Languages, Design and Implementation, 4th
Edition Prentice Hall.
[2] Mac OS X Reference Library, available on web at
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/, Last
check of the address 2013-03-30
[3] XML and Property Lists, available on web at
http://www.satimage.fr/software/en/smile/xml/index.html, Last check of the address 2013-03-30
[4] Lindfors , J., (2002), JMX: Managing J2EE with Java™ Management Extensions, Sams
Publishing.
[5] Pfaff, B., (2004), Performance Analysis of BSTS in System Software, ACM Sigmetrics
Performance Evaluation Review, 32(1), 410–411.
[6] Language features at the Emerging Languages camp, available on web at
http://planets.sun.com/AllRuby/group/jruby/, Last check of the address 2013-03-30
[7] Java Platform Standard Edition 6, available on web at
http://download.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html, Last check of the
address 2013-03-30
[8] Stark, S., the JBoss Group, (2002), JBoss Administration and Development, 2nd Edition, JBoss.
[9] Lamkin, D.B, (2004), Successful Lisp: How to Understand and Use Common Lisp, Electronic
Publisher bookfix.com.

Weitere ähnliche Inhalte

Was ist angesagt?

Towards a New Data Modelling Architecture - Part 1
Towards a New Data Modelling Architecture - Part 1Towards a New Data Modelling Architecture - Part 1
Towards a New Data Modelling Architecture - Part 1
JEAN-MICHEL LETENNIER
 
Database management system chapter12
Database management system chapter12Database management system chapter12
Database management system chapter12
Md. Mahedi Mahfuj
 
final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)
Ankit Rathi
 

Was ist angesagt? (18)

Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
Duplicate Detection in Hierarchical Data Using XPath
Duplicate Detection in Hierarchical Data Using XPathDuplicate Detection in Hierarchical Data Using XPath
Duplicate Detection in Hierarchical Data Using XPath
 
AtomiDB Dr Ashis Banerjee reviews
AtomiDB Dr Ashis Banerjee reviewsAtomiDB Dr Ashis Banerjee reviews
AtomiDB Dr Ashis Banerjee reviews
 
Towards a New Data Modelling Architecture - Part 1
Towards a New Data Modelling Architecture - Part 1Towards a New Data Modelling Architecture - Part 1
Towards a New Data Modelling Architecture - Part 1
 
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
 
Enhancing Big Data Analysis by using Map-reduce Technique
Enhancing Big Data Analysis by using Map-reduce TechniqueEnhancing Big Data Analysis by using Map-reduce Technique
Enhancing Big Data Analysis by using Map-reduce Technique
 
Data and File Structure Lecture Notes
Data and File Structure Lecture NotesData and File Structure Lecture Notes
Data and File Structure Lecture Notes
 
Collections - Sorting, Comparing Basics
Collections - Sorting, Comparing BasicsCollections - Sorting, Comparing Basics
Collections - Sorting, Comparing Basics
 
Unit08 dbms
Unit08 dbmsUnit08 dbms
Unit08 dbms
 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++
 
Database management system chapter12
Database management system chapter12Database management system chapter12
Database management system chapter12
 
Bringing OpenClinica Data into SAS
Bringing OpenClinica Data into SASBringing OpenClinica Data into SAS
Bringing OpenClinica Data into SAS
 
Query Processing, Query Optimization and Transaction
Query Processing, Query Optimization and TransactionQuery Processing, Query Optimization and Transaction
Query Processing, Query Optimization and Transaction
 
358 33 powerpoint-slides_16-files-their-organization_chapter-16
358 33 powerpoint-slides_16-files-their-organization_chapter-16358 33 powerpoint-slides_16-files-their-organization_chapter-16
358 33 powerpoint-slides_16-files-their-organization_chapter-16
 
Data indexing presentation
Data indexing presentationData indexing presentation
Data indexing presentation
 
final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)
 
Query Optimization in MongoDB
Query Optimization in MongoDBQuery Optimization in MongoDB
Query Optimization in MongoDB
 
Programming with matlab session 2
Programming with matlab session 2Programming with matlab session 2
Programming with matlab session 2
 

Andere mochten auch

Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
sparse matrices in tress
sparse matrices in tresssparse matrices in tress
sparse matrices in tress
pavialone
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
Malikireddy Bramhananda Reddy
 
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDYDATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
Malikireddy Bramhananda Reddy
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
Ghaffar Khan
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
eShikshak
 

Andere mochten auch (12)

Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1DATASTRUCTURES UNIT-1
DATASTRUCTURES UNIT-1
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
sparse matrices in tress
sparse matrices in tresssparse matrices in tress
sparse matrices in tress
 
List
ListList
List
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
 
Design Pattern - Factory Method Pattern
Design Pattern - Factory Method PatternDesign Pattern - Factory Method Pattern
Design Pattern - Factory Method Pattern
 
Data structures
Data structuresData structures
Data structures
 
Preparation Data Structures 07 stacks
Preparation Data Structures 07 stacksPreparation Data Structures 07 stacks
Preparation Data Structures 07 stacks
 
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDYDATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
DATA STRUCTURES AND ALGORITHMS UNIT-3 TREES PREPARED BY M V BRAHMANANDA REDDY
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
 

Ähnlich wie A FAST METHOD FOR IMPLEMENTATION OF THE PROPERTY LISTS IN PROGRAMMING LANGUAGES

Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
paperpublications3
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
paperpublications3
 
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information Resource
JEAN-MICHEL LETENNIER
 
Notes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testsNotes of bca Question paper for exams and tests
Notes of bca Question paper for exams and tests
priyanshukumar97908
 

Ähnlich wie A FAST METHOD FOR IMPLEMENTATION OF THE PROPERTY LISTS IN PROGRAMMING LANGUAGES (20)

Expression of Query in XML object-oriented database
Expression of Query in XML object-oriented databaseExpression of Query in XML object-oriented database
Expression of Query in XML object-oriented database
 
Expression of Query in XML object-oriented database
Expression of Query in XML object-oriented databaseExpression of Query in XML object-oriented database
Expression of Query in XML object-oriented database
 
Expression of Query in XML object-oriented database
Expression of Query in XML object-oriented databaseExpression of Query in XML object-oriented database
Expression of Query in XML object-oriented database
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptx
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
 
Bitmap Indexes for Relational XML Twig Query Processing
Bitmap Indexes for Relational XML Twig Query ProcessingBitmap Indexes for Relational XML Twig Query Processing
Bitmap Indexes for Relational XML Twig Query Processing
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
 
J017616976
J017616976J017616976
J017616976
 
M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
 
Ijert semi 1
Ijert semi 1Ijert semi 1
Ijert semi 1
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
 
Collectn framework
Collectn frameworkCollectn framework
Collectn framework
 
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information Resource
 
D0373024030
D0373024030D0373024030
D0373024030
 
Overview of Indexing In Object Oriented Database
Overview of Indexing In Object Oriented DatabaseOverview of Indexing In Object Oriented Database
Overview of Indexing In Object Oriented Database
 
Data structure
Data structureData structure
Data structure
 
Annotating Search Results from Web Databases
Annotating Search Results from Web Databases Annotating Search Results from Web Databases
Annotating Search Results from Web Databases
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
 
Notes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testsNotes of bca Question paper for exams and tests
Notes of bca Question paper for exams and tests
 

Mehr von ijpla

Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
ijpla
 

Mehr von ijpla (20)

International Journal of Programming Languages and Applications (IJPLA)
International Journal of Programming Languages and Applications (IJPLA)International Journal of Programming Languages and Applications (IJPLA)
International Journal of Programming Languages and Applications (IJPLA)
 
A study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point ErrorsA study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point Errors
 
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
 
International Journal of Programming Languages and Applications (IJPLA)
International Journal of Programming Languages and Applications (IJPLA)International Journal of Programming Languages and Applications (IJPLA)
International Journal of Programming Languages and Applications (IJPLA)
 
International Conference on Antennas, Microwave and Microelectronics Engineer...
International Conference on Antennas, Microwave and Microelectronics Engineer...International Conference on Antennas, Microwave and Microelectronics Engineer...
International Conference on Antennas, Microwave and Microelectronics Engineer...
 
INVESTIGATION OF ATTITUDES TOWARDS COMPUTER PROGRAMMING IN TERMS OF VARIOUS V...
INVESTIGATION OF ATTITUDES TOWARDS COMPUTER PROGRAMMING IN TERMS OF VARIOUS V...INVESTIGATION OF ATTITUDES TOWARDS COMPUTER PROGRAMMING IN TERMS OF VARIOUS V...
INVESTIGATION OF ATTITUDES TOWARDS COMPUTER PROGRAMMING IN TERMS OF VARIOUS V...
 
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
Research Paper Submission..!!! Free Publication for Extended papers 3rd Inter...
 
2nd International Conference on Computing and Information Technology (CITE 2024)
2nd International Conference on Computing and Information Technology (CITE 2024)2nd International Conference on Computing and Information Technology (CITE 2024)
2nd International Conference on Computing and Information Technology (CITE 2024)
 
International Journal of Programming Languages and Applications ( IJPLA )
International Journal of Programming Languages and Applications ( IJPLA )International Journal of Programming Languages and Applications ( IJPLA )
International Journal of Programming Languages and Applications ( IJPLA )
 
A Hybrid Bacterial Foraging Algorithm For Solving Job Shop Scheduling Problems
A Hybrid Bacterial Foraging Algorithm For Solving Job Shop Scheduling ProblemsA Hybrid Bacterial Foraging Algorithm For Solving Job Shop Scheduling Problems
A Hybrid Bacterial Foraging Algorithm For Solving Job Shop Scheduling Problems
 
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
5th International Conference on Machine Learning and Soft Computing (MLSC 2024)
 
International Journal of Programming Languages and Applications ( IJPLA )
International Journal of Programming Languages and Applications ( IJPLA )International Journal of Programming Languages and Applications ( IJPLA )
International Journal of Programming Languages and Applications ( IJPLA )
 
3rd International Conference on Computing and Information Technology Trends (...
3rd International Conference on Computing and Information Technology Trends (...3rd International Conference on Computing and Information Technology Trends (...
3rd International Conference on Computing and Information Technology Trends (...
 
HIGH-LEVEL LANGUAGE EXTENSIONS FOR FAST EXECUTION OF PIPELINE-PARALLELIZED CO...
HIGH-LEVEL LANGUAGE EXTENSIONS FOR FAST EXECUTION OF PIPELINE-PARALLELIZED CO...HIGH-LEVEL LANGUAGE EXTENSIONS FOR FAST EXECUTION OF PIPELINE-PARALLELIZED CO...
HIGH-LEVEL LANGUAGE EXTENSIONS FOR FAST EXECUTION OF PIPELINE-PARALLELIZED CO...
 
Research Paper Submission- 5th International Conference on Machine Learning a...
Research Paper Submission- 5th International Conference on Machine Learning a...Research Paper Submission- 5th International Conference on Machine Learning a...
Research Paper Submission- 5th International Conference on Machine Learning a...
 
Submit Your Articles- International Journal of Programming Languages and Appl...
Submit Your Articles- International Journal of Programming Languages and Appl...Submit Your Articles- International Journal of Programming Languages and Appl...
Submit Your Articles- International Journal of Programming Languages and Appl...
 
SELFLESS INHERITANCE
SELFLESS INHERITANCESELFLESS INHERITANCE
SELFLESS INHERITANCE
 
Research Paper Submission- International Conference on Computer Science, Info...
Research Paper Submission- International Conference on Computer Science, Info...Research Paper Submission- International Conference on Computer Science, Info...
Research Paper Submission- International Conference on Computer Science, Info...
 
Research Paper Submission-3rd International Conference on Computing and Infor...
Research Paper Submission-3rd International Conference on Computing and Infor...Research Paper Submission-3rd International Conference on Computing and Infor...
Research Paper Submission-3rd International Conference on Computing and Infor...
 
Submit Your Articles- International Journal of Programming Languages and Appl...
Submit Your Articles- International Journal of Programming Languages and Appl...Submit Your Articles- International Journal of Programming Languages and Appl...
Submit Your Articles- International Journal of Programming Languages and Appl...
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

A FAST METHOD FOR IMPLEMENTATION OF THE PROPERTY LISTS IN PROGRAMMING LANGUAGES

  • 1. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 DOI : 10.5121/ijpla.2013.3201 1 A FAST METHOD FOR IMPLEMENTATION OF THE PROPERTY LISTS IN PROGRAMMING LANGUAGES Hassan Rashidi1 1 Department of Electrical, Computer and IT Engineering, Islamic Azad University, Qazvin Branch, Iran hrashidi@qiau.ac.ir;hrashi@gmail.com ABSTRACT One of the major challenges in programming languages is to support different data structures and their variations in both static and dynamic aspects. One of the these data structures is the property list which applications use it as a convenient way to store, organize, and access standard types of data. In this paper, the standards methods for implementation of the Property Lists, including the Static Array, Link List, Hash and Tree are reviewed. Then an efficient method to implement the property list is presented. The experimental results shows that our method is fast compared with the existing methods. KEYWORDS Programming Languages, Property List, Static Array, Link List, Set, Hash, Tree. 1. INTRODUCTION Many applications and databases require some mechanisms for storing variable-size data objects of information in some situations [1]. A variable-size data objects is one in which the number of components in an object may change dynamically during program execution. Some of the major types of variable-size data structures are list, list structure, stack, queue, tree, directed graph and property list. We focus on the property list, which is a list of alternating names and values. As a formal definition for the property list in the standard textbook [1], a record with a varying number of components is termed as property list if the number of components may vary without restriction. In a property list, both the component names (field names) and their values must be stored. Each field name is termed a property name; the corresponding value of the field is the property value. A property list is also a structured data representation used by Cocoa and Core Foundation [2] as a convenient way to store, organize, and access different types of data. The property list is natural to use when the number and type of components in an object are not known in advance. Property List data structure supports many real-time applications when they read some data from an input device or change attributes of objects during program execution. A common representation for a property list is as an ordinary linked list, with the property names and their values alternating in a single long sequence, as illustrated in Figure 1. In this Figure, the odd number items are property names, and the even are property values. There are three commands to process a property list: • Inserting a new element to the list: When a new property is inserted in the property list, two components are inserted: the property name and its value. • Removing an element from the list: To remove a particular property value (e.g., the value for the ‘Name’ property in Figure 1), the list is searched, looking only at the property
  • 2. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 2 names, until the desired property is found. A pair of component is then deleted from the list. • Finding a value in the list: To select a particular property value (e.g., the value for the ‘Age’ property in Figure 1), the list is searched, looking only at the property names, until the desired property is found. The next list component is then the value for that property. Figure 1. A storage representation of a Property List The Property lists are used extensively by applications and other software on Mac OS X and iOS [2]. For example, the Mac OS X Finder (through bundles) uses property lists to store file and directory attributes. Applications on iOS use property lists in their Settings bundle to define the list of options displayed to users. The Property list has a simple XML format, designed by Apple for OSX as a format for storing lists of key-value pairs (see [3]-[4]). In this operation system, most applications store their Preferences as property list files. The property-list programming interfaces for Cocoa and Core Foundation allow the user to convert hierarchically structured combinations of these basic types of objects to and from standard XML. The user can save the XML data to disk and later use it to reconstruct the original objects. The Property lists are not part of the LISP language, but are an abstraction of common list patterns and usages, and are often defined as LISP library functions. Each item in a list is tagged with a name preceding the item like ( n1 val1 n2 val2 ... nk valk ). In this list ni is the property name of ith element and vali is the property value of ith element. This paper presents a fast method for implementation of the Property List in programming languages. Section 2 makes a literature review over the related works in implementation of the property lists and described the four standards methods. Section 3 presents the detail of the method and makes a comparison on the methods in the main features as well as their complexities. Section 4 is dedicated to some experimental results. This section makes a ‘Salary’ Property List ‘Name’ Pratt ‘Age’ 61 44000
  • 3. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 3 comparison between the times required to perform the operations on the property lists and derives the observations in practise. Section 5 is considered for summary and conclusion. 2. THE RELATED WORK The Property lists organize data into named values and lists of values using several object types. This type of data structure gives the user the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. In this section, the standards existing methods for implementation of Property List are reviewed. 2.1. Link list Method The first choice for implementation of property list is link list. For situations where a user needs to store small amounts of persistent data, for example less than a few hundred kilobytes, property lists offer a uniform and convenient means of organizing, storing, and accessing the data. In these situations, the simplest property-list implementation is a linked list (like Figure 1). The users can either have the alternating elements be the keys and values (LISP does this), or they can have each element be a structure containing pointers to the key and value. The linked list implementation is appropriate when the users: • are just using the pattern to allow user annotations on object instances. • don't expect many such annotations on any given instance. • are not incorporating inheritance, serialization or meta-properties into their use of the pattern. Logically a property list is an unordered set, not a sequential list, but when the set size is small enough a linked list can yield the best performance. The performance of the link list is O(N), so for long property lists the performance can deteriorate rapidly. If the user needs a way to store large complex graphs of objects, objects not supported by the property-list architecture, or objects whose mutability settings must be retained, use Archiving and Serializations[2]. Archiving and serializations are two ways in which the user can create architecture-independent byte streams of hierarchical data. Byte streams can then be written to a file or transmitted to another process, perhaps over a network. When the byte stream is decoded, the hierarchy is regenerated. Archives provide a detailed record of a collection of interrelated objects and values. Serializations record only the simple hierarchy of property-list values. 2.2. Static Array Method The simplest method to implement the property list is the use of fast static arrays with empty slots. In this method, a large array with a specified size for elements is allocated statically, from beginning to the end of execution. For each component, we have to consider a couple of slots (words). The first one is for the component’s name and the second one for component’s value. When the software wants to insert a new element, the first empty slot is selected for the position of insertion. So we have to search to find an empty sot. To remove a particular property value (e.g., the value for the ‘Name’ property in Figure 1), the static array is searched, looking only at the property names, until the desired property is found. After deletion, the pair of slots is marked as the hole/empty slots in the array.
  • 4. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 4 2.3. Hash Method The next most common implementation method is a hash-table, which yields amortized constant- time on the operations of finding, inserting and removing for a given list, albeit at the cost of more memory overhead and a higher fixed per-access cost, i.e. the cost of the hash function. When a confliction occurs on inserting a new element in the list, the solutions of Rehashing, Sequential Search and Bucketing [1] may be used. In most systems, a hash-table imposes too much overhead when objects are expected to have only a handful of properties, up to perhaps two or three dozen [6]. A common solution is to use a hybrid model, in which the property list begins life as a simple array or linked list, and when it crosses some predefined threshold (perhaps 40 to 50 items), the properties are moved into a hash- table. So if we need a tolerant constant-time on access an item and want to maintain the insertion order, we can't do better than a LinkedHashMap [6], a truly wonderful data structure. Java 6.0 implemented this solution. The complexity of this method is O(1). However, the costs of hash- function and its overheads for solving confliction are inevitable. 2.4 Binary Tree Method The 4th method for implementation of property list is binary tree. If a language needs to impose a sort order on property names, it must use an ordered-map implementation, typically an ordered binary tree such as a splay tree or red/black tree (see [5] and [6]). A splay tree can be a good choice because of the low fixed overhead for insertion, lookup and deletion operations, but with the tradeoff that its theoretical worst-case performance is that of a linked list. A splay tree can be especially useful when properties are not always accessed uniformly. If a small subset M of an object's N properties are accessed most often, the amortized performance becomes O(log M), making it a bit like an Least Recently Used (LRU) cache [2]. 3. OUR METHOD- THE SET A set is a data object containing and unordered collection of distinct values. In contract, a list is an ordered collection of values, some of which may be repeated. The basic operations on sets are: (a) Search or Lookup a data value in a set, (b) Insertion and Deletion of single values, and (c) Union, Intersection, and Difference of Sets. This section presents a new and fast method for implementation of the property lists. In some situations, the property-list architecture may prove insufficient [2] and inefficient [9]. Our method for efficient implementation of property list is to present it as a set rather than a list because elements are accessed randomly by subscript (attribute name) rather than sequentially., a root property-list object is at the top of this hierarchy with a couple of pointers like Figure 2. Figure 2. Representation of a property list object In this method, we define a data structure like Table 1, consisting of SetContents to store the contents and Pointers to ith element. We make OR operation together all the properties in the set Property List Pointer to Table1 Pointer to Table2
  • 5. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 5 and store this value in SetContents. The number of elements in the property list is variable with a limit on the maximum. For a 32-bit wordsize of memory, there will be 32 such pointers. The names are stored in a global table like Table 2 with a bit value, representing its position in the set. If a machine has a 32-bit word size, then up to 32 properties can be stored, with bit values of: 1, 10, 100, 1000, and so on. The Bit Strings are shown for clarity; i.e. they can be removed practically because they are in (n=0, 1, 2,.., 31) respectively. The commands to process the property list in this method are as follows: • On lookup operation, we check if the bit string of the property name requested AND SetContents = 0, then the property is not defined in the set. If the value is 1, then the bit position defines the location containing a pointer to its attribute value. • When a new element is to be inserted in the list, we must make a lookup as above. If the property name is in the list, duplication is not possible. If the result of the lookup is negative, the property name is put into an empty position in the Table 2. Then, we make OR operation the SetContents with the corresponding bit string of the property name. After that the corresponding Printer to the property value is set in Table1. • When an existing element is to be removed from the list, we must make a lookup again. If the result of the lookup is positive, then we make an AND operation of SetContents with 00000..00 and store the result in SetContents. After that the memory for property name and property vale are freed and they set to Null in Tables 1 and 2. If the result of the lookup is negative (The result of 0), the element requested doesn’t exist in the list. Table 1. The Data Structure for the method SetContents Pointer to Property Value1 Pointer to Property Value2 ………. ………. Pointer to Property Value32 Table 2. A Global Table with a bit string, representing the position of each property value Bit String Pointers to Property Name 00…..01 00…..10 ……… ……… 10…..00 Since the property lists are based on an abstraction for expressing simple hierarchies of data, they can support the application programs. Some types are for primitive values and others are for containers of values. The primitive types are strings, numbers, binary data, dates, and boolean values. The containers are arrays and dictionaries. The arrays are indexed collections of values and the dictionaries are collections of values each identified by a key. The containers can contain other containers as well as the primitive types. Thus the user might have an array of dictionaries, and each dictionary might contain other arrays and dictionaries, as well as the primitive types. A root property-list object is at the top of this hierarchy, and in almost all cases is a dictionary or an array like Figure 3. Note, however, that a root property-list object does not have to be a dictionary or array; for example, the user could have a single string, number, or date, and that primitive value by itself can constitute an array or a dictionary. Property Name1 Property Name2 Property Name32
  • 6. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 6 The Property list is extensively used in Markup Languages. From the basic abstraction, languages derive both a static representation of the property-list data and a dynamic (runtime) representation of the property list [2]. The static representation of a property list, which is used for storage, can be either XML or binary data. The binary version is a more compact form of the XML property list. In XML, each type is represented by a certain element. The runtime representation of a property list is based on objects corresponding to the abstract types. Both he static and dynamic representation can use our implementation. Figure 3. An array or dictionary of collections of values The property lists are also used to define the SQL Queries in Database Management Systems and JDBC2 Components [8]. The method presented here can by used in these systems and can create more effective Dynamic Data Object. The performance of this method for all operations is O(1). On insertion and deletion operation of an element, although the performance of this method is as the same as the hash-function, it benefits from the lookup operation and practically outperforms the hash because of no overheads. Table 3 makes a summary on the main features and performance of the five methods discussed in this paper. Although the Static Array is simple to implementations, the complexities of the operations are higher. In the Link List method, the property list is presented as an unordered set and has a lower difficulty for implementation. After that, the hash and binary tree are with a high and medium difficulty for implementation, respectively. Both methods have some overheads in run-time during the operations. As shown in the table, our method has no overheads on operations and its implementation is easy. Table 3. A comparison among the methods for implementation of property lists Methods Main Features Complexity of Operations Lookup Insertion Deletion Link List An unordered set, Low difficulty to implement O(N) O(1) O(N) Hash High fixed overhead, High difficulty to implement O(1) O(1) O(1) Valuei1 Valuei2 Valuein Pointer from Table 1 Dictionary Number of Entries
  • 7. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 7 Binary Tree Low fixed overhead, Medium difficulty to implement O(Log N) O(Log N) O(Log N) Static Array Simple to implement, waste of memory O(N) O(N) O(N) Our Method (Set) No overhead, Easy to implement O(1) O(1) O(1) 4. SOME EXPERIMENTAL RESULTS In this section, several experiments are run to compare the standard algorithms and the method presented in this paper. The software was implemented in Borland C++ and then was run to compare the time required to perform several operations on a GenuineIntel 2.599 GHz PC with 1 GMB RAM on Windows XP. Figure 4 shows the main snapshot of our software. Figure 4. The main snapshot of the software The maximum size in the property list is assumed large up to 32 components. At the initial time, between 25 and 29 components are inserted into the property list so that we can run three operations in the same kinds. The length of Name component in the property lists is limited to 32 characters. In the three operations (Insert, Delete and LookUp), the position of insertion, the elements to be Deleted and Looked-Up are selected randomly. In the hash implementation, we used the following algorithm for hash function: (a) Multiply a and b as the values of a member in the set, stored into two sequential words, giving c (two-word product); (b) add together the two words of c, giving one value d; (c) Square d, giving e; and (d) Extract the centre 32 bits of e, giving Ix as the hash index. When we got into conflict, a couple of algorithms, namely Sequential Scan and Budgeting [1], are executed in order. If the first one could not solve the problem, the second one is executed. At the first stage, we ran the software for each single operation Insert, Delete and LookUp and calculated the required time for the operations (see Figure 4). In this stage, the time required to
  • 8. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 8 perform each operation was the same. In the second stage, we write scripts of three operations in various combinations and ran the software. In this stage, we got slightly different times required to perform the scripts. The results of this stage are collected in the Table 4. Table 4. The time required (Micro Second) to perform the operation scripts Row Operations Methods Hash Binary Tree Link List Static Array Our Method (Set) 1 Insert-LookUp-Delete (ILD) 0.09 0.1 0.15 0.18 0.07 2 Insert-Delete-LookUp (IDL) 0.09 0.15 0.21 0.2 0.13 3 Lookup-Insert-Delete (LID) 0.09 0.14 0.17 0.17 0.14 4 LookUp-Delete-Insert (LDI) 0.12 0.2 0.18 0.19 0.08 5 Delete-Insert-LookUp (DIL) 0.09 0.17 0.12 0.18 0.08 6 Delete-LookUp-Insert (DLI) 0.1 0.2 0.22 0.18 0.07 7 Insert-Insert-Insert (III) 0.09 0.1 0.14 0.11 0.07 8 Insert-Insert-LookUp (IIL) 0.14 0.18 0.15 0.15 0.11 9 Insert-Insert-Delete (IID) 0.08 0.1 0.12 0.17 0.09 10 Delete-Delete-Delete (DDD) 0.11 0.19 0.14 0.23 0.08 11 Delete-Delete-Insert (DDI) 0.1 0.12 0.15 0.17 0.12 12 Delete-Delete-LookUp (DDL) 0.09 0.12 0.15 0.23 0.1 13 LookUp-LookUp-LookUp (LLL) 0.12 0.19 0.13 0.15 0.06 14 Lookup-LookUp-Delete (LLD) 0.07 0.1 0.19 0.1 0.09 15 LookUp-LookUp-Insert (LLI) 0.06 0.18 0.18 0.14 0.07 The Average Time 0.096 0.149 0.160 0.170 0.091 Figure 5. A comparison of the time required to perform the operations From the information in the Table-4 and Figure-5, we got the following observations: • Observation-1: The average time required to perform the operations in Static Array and Link are longer than that of the others. These methods have approximately the same average time. This observation is consistent with the results in Table 3.
  • 9. International Journal of Programming Languages and Applications ( IJPLA ) Vol.3, No.2, April 2013 9 • Observation-2: After the Link List and Static Array methods, the Binary Tree has the smallest average time required to do the operations. The average time required to perform the operations in Hash Implementation is shorter than that of the Binary Tree, but it is slightly shorter than that of the Set method. • Observation-3: The average time required to perform the operations in Hash and Set methods is almost the same. The statistical F-test done shows that the differences between our method and others are not significant in the mean value. We believe that the overhead for handling conflict operations was not significant in the operations. 5 SUMMARY AND CONCLUSION Basic differences among the languages refer to the types of data allowed, in the types operations available, and in the mechanisms provided for the implementation. Modern high programming languages need some data structures and their variations in both static and dynamic aspects. In this paper, the standards methods for implementation Property List as Static Array, Link List, Tree and Hash are reviewed. Then a method to implement the property list as Set was presented. The method proposed has more efficiency than the existing methods. In the construction of large application programs, the programmer is almost inevitably concerned with the design and implementation of new data types. The method presented in this paper for implementation of Property List, supports the users so that they can have more flexible and effective dynamic data objects. It can be used in both, at programmer and programming languages levels. For further research, some fast methods could be invented so that some values (names) in a property list have more than one name (value). REFERENCES [1] Pratt, T.W., Zelkowitz, M., (2001), Programming Languages, Design and Implementation, 4th Edition Prentice Hall. [2] Mac OS X Reference Library, available on web at http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/, Last check of the address 2013-03-30 [3] XML and Property Lists, available on web at http://www.satimage.fr/software/en/smile/xml/index.html, Last check of the address 2013-03-30 [4] Lindfors , J., (2002), JMX: Managing J2EE with Java™ Management Extensions, Sams Publishing. [5] Pfaff, B., (2004), Performance Analysis of BSTS in System Software, ACM Sigmetrics Performance Evaluation Review, 32(1), 410–411. [6] Language features at the Emerging Languages camp, available on web at http://planets.sun.com/AllRuby/group/jruby/, Last check of the address 2013-03-30 [7] Java Platform Standard Edition 6, available on web at http://download.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html, Last check of the address 2013-03-30 [8] Stark, S., the JBoss Group, (2002), JBoss Administration and Development, 2nd Edition, JBoss. [9] Lamkin, D.B, (2004), Successful Lisp: How to Understand and Use Common Lisp, Electronic Publisher bookfix.com.