Commit 45ea0150 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Use memcmp to compare module bytes

This is much faster than std::lexicographical_compare.

R=clemensb@chromium.org

Bug: chromium:1048554
Change-Id: I5f0ba22654e172535b6e6fcf6d2a460e278d3cfd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2036078Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66109}
parent e63ab104
...@@ -69,8 +69,10 @@ class NativeModuleCache { ...@@ -69,8 +69,10 @@ class NativeModuleCache {
if (prefix_hash != other.prefix_hash) { if (prefix_hash != other.prefix_hash) {
return prefix_hash < other.prefix_hash; return prefix_hash < other.prefix_hash;
} }
return std::lexicographical_compare( if (bytes.size() != other.bytes.size()) {
bytes.begin(), bytes.end(), other.bytes.begin(), other.bytes.end()); return bytes.size() < other.bytes.size();
}
return memcmp(bytes.begin(), other.bytes.begin(), bytes.size()) < 0;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment