Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: src/list.h

Issue 13933026: Add a performance test showing that List is not as efficient as std::vector. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Better sort Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/list-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 int CountOccurrences(const T& elm, int start, int end) const; 156 int CountOccurrences(const T& elm, int start, int end) const;
157 157
158 // Iterate through all list entries, starting at index 0. 158 // Iterate through all list entries, starting at index 0.
159 void Iterate(void (*callback)(T* x)); 159 void Iterate(void (*callback)(T* x));
160 template<class Visitor> 160 template<class Visitor>
161 void Iterate(Visitor* visitor); 161 void Iterate(Visitor* visitor);
162 162
163 // Sort all list entries (using QuickSort) 163 // Sort all list entries (using QuickSort)
164 void Sort(int (*cmp)(const T* x, const T* y)); 164 void Sort(int (*cmp)(const T* x, const T* y));
165 void Sort(); 165 void Sort();
166 void SortBetter();
166 167
167 INLINE(void Initialize(int capacity, 168 INLINE(void Initialize(int capacity,
168 AllocationPolicy allocator = AllocationPolicy())); 169 AllocationPolicy allocator = AllocationPolicy()));
169 170
170 private: 171 private:
171 T* data_; 172 T* data_;
172 int capacity_; 173 int capacity_;
173 int length_; 174 int length_;
174 175
175 INLINE(T* NewData(int n, AllocationPolicy allocator)) { 176 INLINE(T* NewData(int n, AllocationPolicy allocator)) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 template <typename T, class P> 210 template <typename T, class P>
210 int SortedListBSearch(const List<T>& list, P cmp); 211 int SortedListBSearch(const List<T>& list, P cmp);
211 template <typename T> 212 template <typename T>
212 int SortedListBSearch(const List<T>& list, T elem); 213 int SortedListBSearch(const List<T>& list, T elem);
213 214
214 215
215 } } // namespace v8::internal 216 } } // namespace v8::internal
216 217
217 218
218 #endif // V8_LIST_H_ 219 #endif // V8_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | src/list-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698