diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-23 00:43:34 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-23 00:43:34 +0000 |
commit | 4fa642feef61c12f55ec3d75e178aa2d677194de (patch) | |
tree | 32ab1c53f40a525f600ece06f1d0cd359053694b /net/base/effective_tld_names_unittest1.gperf | |
parent | f09bc4e35d0bed570fcc1767bf8e1272913d2590 (diff) | |
download | chromium_src-4fa642feef61c12f55ec3d75e178aa2d677194de.zip chromium_src-4fa642feef61c12f55ec3d75e178aa2d677194de.tar.gz chromium_src-4fa642feef61c12f55ec3d75e178aa2d677194de.tar.bz2 |
Use a perfect hash map for the registry controlled domain service.
On my very fast machine, building the std::set in release mode on startup and blocks the UI thread for 15ms (there are > 3300 entries). It also uses 275KB of memory, not including 50KB of data in the dll. Using a perfect hash map, there's no startup cost. The dll's size increases by 135KB but there's no extra memory consumption, leading to a memory reduction of 140KB.
Review URL: http://codereview.chromium.org/515001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/effective_tld_names_unittest1.gperf')
-rw-r--r-- | net/base/effective_tld_names_unittest1.gperf | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/base/effective_tld_names_unittest1.gperf b/net/base/effective_tld_names_unittest1.gperf new file mode 100644 index 0000000..f7bb428 --- /dev/null +++ b/net/base/effective_tld_names_unittest1.gperf @@ -0,0 +1,23 @@ +%{ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// Test file used by registry_controlled_domain_unittest. +// We edit this file manually, then run +// gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test1 -D effective_tld_names_unittest1.gperf > effective_tld_names_unittest1.cc +// to generate the perfect hashmap. +%} +struct DomainRule { + const char *name; + int type; // 1: exception, 2: wildcard +}; +%% +jp, 0 +ac.jp, 0 +bar.jp, 2 +baz.bar.jp, 2 +pref.bar.jp, 1 +bar.baz.com, 0 +c, 2 +b.c, 1 +%% |