[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:27:06 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a518384654136c8e0fbe453c63290b39d22009e3
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Mar 4 01:13:26 2003 +0000
JavaScriptCore:
Reviewed by Trey.
- fixed 3158833 - ebay prefs page is so slow, it seems like a hang.
92% speed improvement on ebay prefs page.
1% speed improvement on js-ibench and js-performance plt suites.
There were a couple of problems with the identifier hash table that
I fixed:
* kjs/identifier.cpp:
(void Identifier::remove): Adjust the shrink threshold to avoid
constantly growing and shrinking.
* kjs/ustring.cpp:
(UString::Rep::computeHash): Use a better hash function that
avoids collisions for obvious data sets.
WebFoundation:
Reviewed by Trey.
Updated string hash function to match the new, improved one in
JavaScriptCore.
* Database.subproj/WebLRUFileList.m:
(cStringHash):
WebCore:
Reviewed by Trey.
Updated string hash function to match the new, improved one in
JavaScriptCore.
* kwq/KWQCharsets.mm:
(encodingNameHash):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3736 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 886a7d0..e36d7ff 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,22 @@
+2003-03-02 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Trey.
+
+ - fixed 3158833 - ebay prefs page is so slow, it seems like a hang.
+
+ 92% speed improvement on ebay prefs page.
+ 1% speed improvement on js-ibench and js-performance plt suites.
+
+ There were a couple of problems with the identifier hash table that
+ I fixed:
+
+ * kjs/identifier.cpp:
+ (void Identifier::remove): Adjust the shrink threshold to avoid
+ constantly growing and shrinking.
+ * kjs/ustring.cpp:
+ (UString::Rep::computeHash): Use a better hash function that
+ avoids collisions for obvious data sets.
+
=== Safari-64 ===
=== Safari-63 ===
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 886a7d0..e36d7ff 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-03-02 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Trey.
+
+ - fixed 3158833 - ebay prefs page is so slow, it seems like a hang.
+
+ 92% speed improvement on ebay prefs page.
+ 1% speed improvement on js-ibench and js-performance plt suites.
+
+ There were a couple of problems with the identifier hash table that
+ I fixed:
+
+ * kjs/identifier.cpp:
+ (void Identifier::remove): Adjust the shrink threshold to avoid
+ constantly growing and shrinking.
+ * kjs/ustring.cpp:
+ (UString::Rep::computeHash): Use a better hash function that
+ avoids collisions for obvious data sets.
+
=== Safari-64 ===
=== Safari-63 ===
diff --git a/JavaScriptCore/kjs/identifier.cpp b/JavaScriptCore/kjs/identifier.cpp
index 07089db..4e896a5 100644
--- a/JavaScriptCore/kjs/identifier.cpp
+++ b/JavaScriptCore/kjs/identifier.cpp
@@ -254,7 +254,7 @@ void Identifier::remove(UString::Rep *r)
_table[i] = 0;
--_keyCount;
- if (_keyCount * 3 < _tableSize && _tableSize > _minTableSize) {
+ if (_keyCount * 6 < _tableSize && _tableSize > _minTableSize) {
shrink();
return;
}
diff --git a/JavaScriptCore/kjs/ustring.cpp b/JavaScriptCore/kjs/ustring.cpp
index a5716e8..1806d67 100644
--- a/JavaScriptCore/kjs/ustring.cpp
+++ b/JavaScriptCore/kjs/ustring.cpp
@@ -177,34 +177,76 @@ void UString::Rep::destroy()
delete this;
}
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+// or anything like that.
+const unsigned PHI = 0x9e3779b9U;
+
+// This hash algorithm comes from:
+// http://burtleburtle.net/bob/hash/hashfaq.html
+// http://burtleburtle.net/bob/hash/doobs.html
unsigned UString::Rep::computeHash(const UChar *s, int length)
{
int prefixLength = length < 8 ? length : 8;
int suffixPosition = length < 16 ? 8 : length - 8;
- unsigned h = length;
- for (int i = 0; i < prefixLength; i++)
- h = 127 * h + s[i].uc;
- for (int i = suffixPosition; i < length; i++)
- h = 127 * h + s[i].uc;
+ unsigned h = PHI;
+ h += length;
+ h += (h << 10);
+ h ^= (h << 6);
+
+ for (int i = 0; i < prefixLength; i++) {
+ h += s[i].uc;
+ h += (h << 10);
+ h ^= (h << 6);
+ }
+ for (int i = suffixPosition; i < length; i++){
+ h += s[i].uc;
+ h += (h << 10);
+ h ^= (h << 6);
+ }
+
+ h += (h << 3);
+ h ^= (h >> 11);
+ h += (h << 15);
+
if (h == 0)
h = 0x80000000;
+
return h;
}
+// This hash algorithm comes from:
+// http://burtleburtle.net/bob/hash/hashfaq.html
+// http://burtleburtle.net/bob/hash/doobs.html
unsigned UString::Rep::computeHash(const char *s)
{
int length = strlen(s);
int prefixLength = length < 8 ? length : 8;
int suffixPosition = length < 16 ? 8 : length - 8;
- unsigned h = length;
- for (int i = 0; i < prefixLength; i++)
- h = 127 * h + (unsigned char)s[i];
- for (int i = suffixPosition; i < length; i++)
- h = 127 * h + (unsigned char)s[i];
+ unsigned h = PHI;
+ h += length;
+ h += (h << 10);
+ h ^= (h << 6);
+
+ for (int i = 0; i < prefixLength; i++) {
+ h += (unsigned char)s[i];
+ h += (h << 10);
+ h ^= (h << 6);
+ }
+ for (int i = suffixPosition; i < length; i++) {
+ h += (unsigned char)s[i];
+ h += (h << 10);
+ h ^= (h << 6);
+ }
+
+ h += (h << 3);
+ h ^= (h >> 11);
+ h += (h << 15);
+
if (h == 0)
h = 0x80000000;
+
return h;
}
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 072a015..640beeb 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,13 @@
+2003-03-02 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Trey.
+
+ Updated string hash function to match the new, improved one in
+ JavaScriptCore.
+
+ * kwq/KWQCharsets.mm:
+ (encodingNameHash):
+
2003-03-03 Darin Adler <darin at apple.com>
Reviewed by Dave.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 072a015..640beeb 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2003-03-02 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Trey.
+
+ Updated string hash function to match the new, improved one in
+ JavaScriptCore.
+
+ * kwq/KWQCharsets.mm:
+ (encodingNameHash):
+
2003-03-03 Darin Adler <darin at apple.com>
Reviewed by Dave.
diff --git a/WebCore/kwq/KWQCharsets.mm b/WebCore/kwq/KWQCharsets.mm
index 4a96a21..8fa53bc 100644
--- a/WebCore/kwq/KWQCharsets.mm
+++ b/WebCore/kwq/KWQCharsets.mm
@@ -103,11 +103,19 @@ static Boolean encodingNamesEqual(const void *value1, const void *value2)
}
}
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+// or anything like that.
+const unsigned PHI = 0x9e3779b9U;
+
+// This hash algorithm comes from:
+// http://burtleburtle.net/bob/hash/hashfaq.html
+// http://burtleburtle.net/bob/hash/doobs.html
static CFHashCode encodingNameHash(const void *value)
{
const char *s = (const char *)value;
- CFHashCode h = 0;
+ CFHashCode h = PHI;
+
for (int i = 0; i != 16; ++i) {
char c;
do {
@@ -116,10 +124,18 @@ static CFHashCode encodingNameHash(const void *value)
if (!c) {
break;
}
- h = 127 * h + tolower(c);
+ h += c;
+ h += (h << 10);
+ h ^= (h << 6);
}
+
+ h += (h << 3);
+ h ^= (h >> 11);
+ h += (h << 15);
+
if (h == 0) {
h = 0x80000000;
}
+
return h;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list