Switch RuleMap to a custom hash table.

A significant part of style (~6%) is doing lookups in RuleMaps,
specifically in AtomicString-indexed hash tables. These currently
use WTF::HashTable, but we can do better with a custom
hash table implementation. Thus, we implement RobinHoodMap,
a lookup-optimized variant with higher load factor and thus
tighter memory footprint.

One direct consequence of this is less RAM usage; e.g. Social1
reports ~460 kB less PartitionAlloc memory allocated (most subtests
have smaller hash tables, though, since they have fewer rules).
But we also get less cache pressure. The exact result depends
on the CPU; smaller/slower caches give more gains, less sophisticated
branch predictors give less gains. In general, most seem to be
around neutral, but Intel CPUs give a fairly good gain. Inserts
are slightly slower and lookups are faster, so repeated style
application should get larger gains. Of course, in the style
perftest, we have the cache all to ourselves, so it will tend to
underestimate these effects somewhat.

Style perftest (Alder Lake P-cores, LTO but no PGO):

Initial style (µs)     Before     After    Perf      95% CI (BCa)
=================== ========= ========= ======= =================
ECommerce                4491      4484   +0.1%  [ -0.6%,  +0.8%]
Encyclopedia            40679     39868   +2.0%  [ +1.1%,  +2.9%]
Extension               53970     53971   -0.0%  [ -0.8%,  +0.7%]
News                    19728     19325   +2.1%  [ +0.9%,  +3.2%]
Search                   6316      6176   +2.3%  [ +1.1%,  +3.4%]
Social1                 11547     11753   -1.8%  [ -2.8%,  -0.7%]
Social2                  7383      7281   +1.4%  [ +0.4%,  +2.3%]
Sports                  20644     20580   +0.3%  [ -0.8%,  +1.4%]
Video                   16020     16064   -0.3%  [ -1.1%,  +0.5%]
Geometric mean                            +0.7%  [ +0.1%,  +1.2%]

Recalc style (µs)      Before     After    Perf      95% CI (BCa)
=================== ========= ========= ======= =================
ECommerce                5011      4958   +1.1%  [ +0.3%,  +1.8%]
Encyclopedia            32407     31336   +3.4%  [ +2.6%,  +4.3%]
Extension               49217     48970   +0.5%  [ -0.3%,  +1.2%]
News                    15065     14569   +3.4%  [ +2.3%,  +4.4%]
Search                   2911      2771   +5.0%  [ +4.3%,  +5.9%]
Social1                  7417      7271   +2.0%  [ +0.8%,  +3.0%]
Social2                  5634      5548   +1.5%  [ +0.6%,  +2.4%]
Sports                  11345     11040   +2.8%  [ +1.9%,  +3.6%]
Video                   10659     10381   +2.7%  [ +1.8%,  +3.6%]
Geometric mean                            +2.5%  [ +1.9%,  +3.0%]

Change-Id: I3b25f24d0595b21ad5d5e354e2c03a390bddc5aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4866725
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1200933}
1 file changed
tree: 87401428bc0b829ffb3d0ee44c83564182dbe847
  1. .github/
  2. .well-known/
  3. accelerometer/
  4. accessibility/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. attribution-reporting/
  15. audio-output/
  16. autoplay-policy-detection/
  17. avif/
  18. background-fetch/
  19. background-sync/
  20. badging/
  21. battery-status/
  22. beacon/
  23. bluetooth/
  24. browsing-topics/
  25. captured-mouse-events/
  26. clear-site-data/
  27. client-hints/
  28. clipboard-apis/
  29. close-watcher/
  30. common/
  31. compat/
  32. compression/
  33. compute-pressure/
  34. conformance-checkers/
  35. console/
  36. contacts/
  37. content-dpr/
  38. content-index/
  39. content-security-policy/
  40. contenteditable/
  41. cookie-deprecation-label/
  42. cookie-store/
  43. cookies/
  44. core-aam/
  45. cors/
  46. credential-management/
  47. css/
  48. custom-elements/
  49. custom-state-pseudo-class/
  50. delegated-ink/
  51. density-size-correction/
  52. deprecation-reporting/
  53. device-memory/
  54. direct-sockets/
  55. docs/
  56. document-picture-in-picture/
  57. document-policy/
  58. dom/
  59. domparsing/
  60. domxpath/
  61. dpub-aam/
  62. dpub-aria/
  63. ecmascript/
  64. editing/
  65. element-timing/
  66. encoding/
  67. encoding-detection/
  68. encrypted-media/
  69. entries-api/
  70. event-timing/
  71. eventsource/
  72. eyedropper/
  73. feature-policy/
  74. fenced-frame/
  75. fetch/
  76. file-system-access/
  77. FileAPI/
  78. fledge/
  79. focus/
  80. font-access/
  81. fonts/
  82. forced-colors-mode/
  83. fs/
  84. fullscreen/
  85. gamepad/
  86. generic-sensor/
  87. geolocation-API/
  88. geolocation-sensor/
  89. graphics-aam/
  90. graphics-aria/
  91. gyroscope/
  92. hr-time/
  93. html/
  94. html-aam/
  95. html-longdesc/
  96. html-media-capture/
  97. https-upgrades/
  98. idle-detection/
  99. imagebitmap-renderingcontext/
  100. images/
  101. import-maps/
  102. IndexedDB/
  103. inert/
  104. infrastructure/
  105. input-device-capabilities/
  106. input-events/
  107. installedapp/
  108. interfaces/
  109. intersection-observer/
  110. intervention-reporting/
  111. is-input-pending/
  112. js/
  113. js-self-profiling/
  114. keyboard-lock/
  115. keyboard-map/
  116. largest-contentful-paint/
  117. layout-instability/
  118. lifecycle/
  119. loading/
  120. long-animation-frame/
  121. longtask-timing/
  122. magnetometer/
  123. managed/
  124. mathml/
  125. measure-memory/
  126. media/
  127. media-capabilities/
  128. media-playback-quality/
  129. media-source/
  130. mediacapture-extensions/
  131. mediacapture-fromelement/
  132. mediacapture-handle/
  133. mediacapture-image/
  134. mediacapture-insertable-streams/
  135. mediacapture-record/
  136. mediacapture-region/
  137. mediacapture-streams/
  138. mediasession/
  139. merchant-validation/
  140. mimesniff/
  141. mixed-content/
  142. mst-content-hint/
  143. navigation-api/
  144. navigation-timing/
  145. netinfo/
  146. network-error-logging/
  147. notifications/
  148. old-tests/
  149. orientation-event/
  150. orientation-sensor/
  151. page-lifecycle/
  152. page-visibility/
  153. paint-timing/
  154. parakeet/
  155. payment-handler/
  156. payment-method-basic-card/
  157. payment-method-id/
  158. payment-request/
  159. pending-beacon/
  160. performance-timeline/
  161. periodic-background-sync/
  162. permissions/
  163. permissions-policy/
  164. permissions-request/
  165. permissions-revoke/
  166. picture-in-picture/
  167. png/
  168. pointerevents/
  169. pointerlock/
  170. portals/
  171. preload/
  172. presentation-api/
  173. print/
  174. private-aggregation/
  175. private-click-measurement/
  176. proximity/
  177. push-api/
  178. quirks/
  179. referrer-policy/
  180. remote-playback/
  181. reporting/
  182. requestidlecallback/
  183. resize-observer/
  184. resource-timing/
  185. resources/
  186. sanitizer-api/
  187. savedata/
  188. scheduler/
  189. screen-capture/
  190. screen-details/
  191. screen-orientation/
  192. screen-wake-lock/
  193. scroll-animations/
  194. scroll-to-text-fragment/
  195. secure-contexts/
  196. secure-payment-confirmation/
  197. selection/
  198. serial/
  199. server-timing/
  200. service-workers/
  201. shadow-dom/
  202. shape-detection/
  203. shared-storage/
  204. shared-storage-selecturl-limit/
  205. signed-exchange/
  206. soft-navigation-heuristics/
  207. speculation-rules/
  208. speech-api/
  209. storage/
  210. storage-access-api/
  211. streams/
  212. subapps/
  213. subresource-integrity/
  214. svg/
  215. svg-aam/
  216. timing-entrytypes-registry/
  217. tools/
  218. top-level-storage-access-api/
  219. touch-events/
  220. trust-tokens/
  221. trusted-types/
  222. ua-client-hints/
  223. uievents/
  224. upgrade-insecure-requests/
  225. url/
  226. urlpattern/
  227. user-timing/
  228. vibration/
  229. video-rvfc/
  230. virtual-keyboard/
  231. visual-viewport/
  232. wai-aria/
  233. wasm/
  234. web-animations/
  235. web-bundle/
  236. web-locks/
  237. web-nfc/
  238. web-otp/
  239. web-share/
  240. webaudio/
  241. webauthn/
  242. webcodecs/
  243. WebCryptoAPI/
  244. webdriver/
  245. webgl/
  246. webgpu/
  247. webhid/
  248. webidl/
  249. webmessaging/
  250. webmidi/
  251. webnn/
  252. webrtc/
  253. webrtc-encoded-transform/
  254. webrtc-extensions/
  255. webrtc-ice/
  256. webrtc-identity/
  257. webrtc-priority/
  258. webrtc-stats/
  259. webrtc-svc/
  260. websockets/
  261. webstorage/
  262. webtransport/
  263. webusb/
  264. webvr/
  265. webvtt/
  266. webxr/
  267. window-management/
  268. workers/
  269. worklets/
  270. x-frame-options/
  271. xhr/
  272. .azure-pipelines.yml
  273. .gitattributes
  274. .gitignore
  275. .mailmap
  276. .taskcluster.yml
  277. CODE_OF_CONDUCT.md
  278. CODEOWNERS
  279. CONTRIBUTING.md
  280. LICENSE.md
  281. lint.ignore
  282. README.md
  283. wpt
  284. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status documentation manifest Python 3

The web-platform-tests Project is a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the wpt:matrix.org matrix channel; includes participants located around the world, but busiest during the European working day.
  • Mailing list: a public and low-traffic discussion list
  • RFCs: a repo for requesting comments on substantial changes that would impact other stakeholders or users; people who work on WPT infra are encouraged to watch the repo.

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.
  • wpt serve-wave - For starting the wpt http server and the WAVE test runner. For more details on how to use the WAVE test runner see the documentation.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to wpt.live and w3c-test.org.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!