Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Перейти к файлу
Michael Comella b6c9a1f711 Bug 1369604: Replace features HashMap with indexing into an array. r=liuche
After the previous changeset, some numbers stood out:
- HighlightsRanking.extractFeatures: 44.9%
- HighlightCandidate.getFeatureValue: 19.4%
- Collections.secondaryHash: 17.3%
- HashMap.get: 11.7%

My hypothesis was that our HighlightCandidate.features implementation was slow:
it was mapping FeatureNames -> values in a HashMap but HashMap look-ups are
slower than a direct memory access.

I replaced the implementation with a direct access from an array - about as
fast as we can get. This encouraged me to make some changes with the following
benefits:
- Rewrote HighlightsRanking.normalize to save iterations and allocations.
- Rm code from HighlightsRanking.scoreEntries: we no longer need to iterate to
construct the filtered items, we just index directly into the list
- Rewrote HighlightsRanking.decay(), which I think is a little clearer now.
- Saved a few iterator/object allocations inside inner loops in places.

The tests pass and we have coverage for the normalize changes but not for
scoreEntries.

---

For perf, my changes affected multiple methods so the percentages are no longer
reliable but I can verify absolute runtime changes. I ran three tests, the best
of which showed an overall 33% runtime compared to the previous changeset and
the other two profiles showed a 66% overall runtime. In particular, for the
middle run, the changes for affected methods go from X microseconds to Y
microseconds:
- Features.get: 3,554,796 -> 322,145
- secondaryHash: 3,165,785 -> 35,253
- HighlightsRanking.normalize: 6,578,481 -> 1,734,078
- HighlightsRanking.scoreEntries: 3,017,272 -> 448,300

As far as I know, my changes should not have introduced any new inefficiencies
to the code.

MozReview-Commit-ID: 9THXe8KqBbB

--HG--
extra : rebase_source : 2358fe83acebaf04a61d912e88f8cf420b7df3d7
2017-07-26 17:16:14 -07:00
.cargo
.vscode Bug 1377937 - Fix VSCode tasks on Windows (NPOTB, DONTBUILD). r=gps 2017-07-03 21:55:07 +03:00
accessible Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
addon-sdk Bug 1279218 - Remove Applet tag; r=bz 2017-07-10 16:00:30 -07:00
browser Bug 1356271 - add a test to measure how many layout flushes it takes for a simple location bar search. r=florian 2017-06-14 15:45:33 -04:00
build Backed out changeset 0c2bc12f4ebe (bug 1384396) for breaking builds when hg username has non-ascii characters. r=backout a=backout on a CLOSED TREE 2017-07-27 14:56:29 +02:00
caps Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
chrome Backed out changeset ef5feef07bed (bug 1384835) 2017-07-28 10:29:24 +02:00
config Bug 641212 - use lzma compression for application update. Part 1 - xz-embedded build config changes. r=glandium, a=app_update_lzma 2017-07-30 23:26:56 -07:00
db Bug 1371364 - Upgrade to SQLite 3.19.3. r=mak 2017-06-08 15:23:34 -04:00
devtools Bug 1378820 - remove usage of sdk/clipboard in devtools clipboard helper;r=gl 2017-07-31 14:02:37 +02:00
docshell Bug 1380012 - Copy nsSHEntry::mResultPrincipalURI in its copy constructor. r=bz 2017-07-29 13:04:39 -04:00
dom Bug 1384542: Move GetParent and IsLinkContext to GeckoStyleContext. r=heycam 2017-07-31 14:32:59 +02:00
editor merge mozilla-inbound to mozilla-central a=merge 2017-07-28 15:24:39 +02:00
embedding Bug 1356569 - Remove notifyObservers' last parameter when it is falsy, r=jaws. 2017-04-14 21:51:39 +02:00
extensions Backed out changeset ef5feef07bed (bug 1384835) 2017-07-28 10:29:24 +02:00
gfx merge mozilla-inbound to mozilla-central. r=merge a=merge 2017-07-31 11:11:05 +02:00
gradle/wrapper
hal Bug 1382099 - Remove MOZ_WIDGET_GONK from hal/. r=gsvelto. 2017-07-24 10:08:55 +10:00
image Backed out changeset ef5feef07bed (bug 1384835) 2017-07-28 10:29:24 +02:00
intl Backed out changeset 07b534f44740 (bug 1384835) for failing xpcshell's security/manager/ssl/tests/unit/test_cert_sha1.js checkCertErrorGenericAtTime on Linux x64 debug. r=backout 2017-07-28 10:30:29 +02:00
ipc Bug 1369669: Resolve junction points and symlinks in the child executable path before launching. r=jimm 2017-07-29 09:29:56 +01:00
js Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
layout Bug 1384542: Fix MustReresolveStyle logic. r=me 2017-07-31 15:57:25 +02:00
media Backed out changeset 07b534f44740 (bug 1384835) for failing xpcshell's security/manager/ssl/tests/unit/test_cert_sha1.js checkCertErrorGenericAtTime on Linux x64 debug. r=backout 2017-07-28 10:30:29 +02:00
memory Bug 1382076 - Use FramePointerStackWalk() in DMD on Win32. r=erahm. 2017-07-20 11:33:31 +10:00
mfbt merge mozilla-inbound to mozilla-central a=merge 2017-07-27 10:57:25 +02:00
mobile Bug 1369604: Replace features HashMap with indexing into an array. r=liuche 2017-07-26 17:16:14 -07:00
modules Bug 1105689 - use SHA384 certificates to sign app update mar files. Part 3 - libmar test extracted SHA384 signatures from the test mar files. r=mhowell, a=app_update_sha384 2017-07-30 23:27:36 -07:00
mozglue Bug 1384233 - Update documentation for the %I format specifier in Printf.h. r=froydnj 2017-07-26 16:22:58 -04:00
netwerk Bug 1385356 - Skip browser_tabicon_after_bg_tab_crash.js and browser_child_resources.js if crashreporter is disabled, r=mccr8 2017-07-28 14:47:00 -04:00
nsprpub Bug 1372579, uplift NSPR_4_16_RTM, no code changes, only version numbers, r=me 2017-07-27 15:33:57 +02:00
other-licenses Bug 1375472 - Use an optimized build of the 7-zip SFX stub. r=rstrong 2017-07-05 10:17:00 -07:00
parser Backed out changeset ef5feef07bed (bug 1384835) 2017-07-28 10:29:24 +02:00
probes Bug 1344878 - add BUG_COMPONENT to probes/* files. r=Ms2ger 2017-03-24 09:50:48 -04:00
python Bug 1376306 - Update tests to reflect new Java version requirement; r=me 2017-07-28 17:40:00 -07:00
rdf Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
security Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
services Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
servo servo: Merge #17924 - stylo: Get rid of GetParentAllowServo (from emilio:die-getparentallowservo-die); r=heycam 2017-07-31 05:27:56 -05:00
startupcache Bug 1383215: Part 2 - Split out URI resolution code into ResolveURI helper. r=mccr8 2017-07-21 15:12:32 -07:00
storage Bug 1350958 - Finish labeling ProxyReleaseEvent, r=billm 2017-07-14 08:49:22 +02:00
taskcluster merge mozilla-inbound to mozilla-central. r=merge a=merge 2017-07-30 11:19:17 +02:00
testing Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
third_party No bug - Revendor rust dependencies 2017-07-28 08:23:45 +00:00
toolkit Bug 1381605 - Do not load ExtensionSettingsStore's JSON file synchronously, r=aswan 2017-07-24 15:49:30 -04:00
tools Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout 2017-07-31 14:44:34 +02:00
uriloader Backed out changeset 07b534f44740 (bug 1384835) for failing xpcshell's security/manager/ssl/tests/unit/test_cert_sha1.js checkCertErrorGenericAtTime on Linux x64 debug. r=backout 2017-07-28 10:30:29 +02:00
view Backed out changeset 497dbf087ad5 (add diagnostic asserts) (bug 1354933) 2017-07-07 14:54:55 -05:00
widget Merge inbound to central, a=merge 2017-07-28 17:40:43 -07:00
xpcom Backed out changeset 07b534f44740 (bug 1384835) for failing xpcshell's security/manager/ssl/tests/unit/test_cert_sha1.js checkCertErrorGenericAtTime on Linux x64 debug. r=backout 2017-07-28 10:30:29 +02:00
xpfe Bug 1355147 - Add basic support for headless mode on macOS. r=jrmuizel 2017-07-28 11:00:27 -07:00
.clang-format Backed out changeset b14cbbf5256a (bug 1378250) on request from sylvestre 2017-07-05 16:55:27 +02:00
.clang-format-ignore Bug 1374730 - Follow-up to update some non-code mentions of webrender_traits to webrender_api. r=me and DONTBUILD 2017-07-26 09:56:52 -04:00
.clang-tidy
.cron.yml bug 1384794 - Don't schedule win nightlies explicitly, because we are scheduling all desktop at once now. r=aki a=bustage 2017-07-27 21:14:48 -04:00
.eslintignore Backed out changeset d0ed0997f4e0 (bug 1369801) 2017-07-27 18:14:48 +02:00
.eslintrc.js Bug 1359011 - Make the mozilla/recommended eslint configuration the default for the whole tree. r=mossop 2017-04-25 20:12:21 +01:00
.flake8 Bug 1288432 - Use new mozlint configuration for flake8 linter, r=bc 2017-06-02 09:46:01 -04:00
.gdbinit
.gdbinit_python Bug 1346025 - Move vendored python modules from /python to /third_party/python, r=ted 2017-05-25 11:48:03 -04:00
.gitignore Bug 1382304: hg/gitignore captures/ dir. r=nalexander 2017-07-19 11:08:06 -07:00
.hgignore Bug 1382304: hg/gitignore captures/ dir. r=nalexander 2017-07-19 11:08:06 -07:00
.hgtags No bug - Tagging mozilla-central f9605772a0c9098ed1bcaa98089b2c944ed69e9b with FIREFOX_BETA_55_BASE a=release DONTBUILD CLOSED TREE 2017-06-12 12:50:30 +01:00
.inferconfig Bug 1357629 - Add httpclientandroidlib to .inferconfig ignore list r=nalexander,njpark 2017-04-18 20:05:25 -07:00
.lldbinit Bug 1346025 - Move vendored python modules from /python to /third_party/python, r=ted 2017-05-25 11:48:03 -04:00
.taskcluster.yml Bug 1328727: revert to --base-repository=https://hg.mozilla.org/mozilla-central; r=gps 2017-07-25 01:26:41 +00:00
.ycm_extra_conf.py
AUTHORS Bug 1111333 - Enable double-tap-drag to zoom. r=kats 2017-05-23 19:53:06 +02:00
Android.mk
CLOBBER Backed out changeset 485d1af7805a (bug 1338651) for valgrind issues a=backout 2017-06-30 14:44:28 -07:00
GNUmakefile
LEGAL
LICENSE
Makefile.in Bug 1382502 - Enable sccache on PGO builds. r=ted 2017-07-20 11:31:14 +09:00
README.txt
aclocal.m4 Bug 1363992 - Remove jemalloc 4. r=njn 2017-05-11 13:23:07 +09:00
build.gradle Bug 1255227 - Part 1: Stop using deprecated android-sdk-manager Gradle plugin. r=sebastian 2017-07-18 09:46:09 -07:00
client.mk
client.py
configure.in
configure.py
gradle.properties
gradlew
mach
moz.build bug 1370176, generic configuration for l10n, r=flod,gps 2017-06-05 10:28:33 +02:00
moz.configure Backed out changeset 2a1b1485ffc7 (bug 1384396) 2017-07-27 14:53:46 +02:00
mozilla-config.h.in Bug 1371266 - libpng should be built with -std=c89. r=glennrp 2017-06-08 06:29:03 -07:00
npm-shrinkwrap.json Bug 1380956 - List only the directly required dependencies for ESLint in the top-level package.json. r=ahal 2017-07-14 12:21:54 +01:00
old-configure.in merge mozilla-inbound to mozilla-central a=merge 2017-07-27 10:57:25 +02:00
package.json Bug 1380956 - List only the directly required dependencies for ESLint in the top-level package.json. r=ahal 2017-07-14 12:21:54 +01:00
settings.gradle Backed out 2 changesets (bug 1355625) for causing bustage a=backout 2017-06-22 12:05:56 -07:00
test.mozbuild

README.txt

An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:

    https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure

For information on how to build Mozilla from the source code, see:

    https://developer.mozilla.org/en/docs/Build_Documentation

To have your bug fix / feature added to Mozilla, you should create a patch and
submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:

    https://developer.mozilla.org/en/docs/Creating_a_patch
    https://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree

If you have a question about developing Mozilla, and can't find the solution
on https://developer.mozilla.org, you can try asking your question in a
mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]

You can download nightly development builds from the Mozilla FTP server.
Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy. Firefox nightlies, for example, can be found at:

    https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
            - or -
    https://nightly.mozilla.org/