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

Unified Diff: src/zone.cc

Issue 18057004: Refactored code a bit to improve StringReplace performance (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/zone.cc
===================================================================
--- src/zone.cc (revision 15496)
+++ src/zone.cc (working copy)
@@ -92,18 +92,15 @@
#endif
// Find a segment with a suitable size to keep around.
- Segment* keep = segment_head_;
- while (keep != NULL && keep->size() > kMaximumKeptSegmentSize) {
- keep = keep->next();
- }
-
+ Segment* keep = NULL;
// Traverse the chained list of segments, zapping (in debug mode)
// and freeing every segment except the one we wish to keep.
for (Segment* current = segment_head_; current != NULL; ) {
Segment* next = current->next();
- if (current == keep) {
+ if (keep == NULL && current->size() <= kMaximumKeptSegmentSize) {
// Unlink the segment we wish to keep from the list.
- current->clear_next();
+ keep = current;
+ keep->clear_next();
} else {
int size = current->size();
#ifdef DEBUG
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698