Browse Source

Add config options for string hash changes

- Add DUK_USE_STRHASH_SKIP_SHIFT option for the "fast" skipping hash.

- Add DUK_USE_STRHASH_DENSE option (default false) to revert back to
  the Duktape 1.3.0 string hash algorithm.
pull/432/head
Sami Vaarala 9 years ago
parent
commit
49177c7151
  1. 10
      config/config-options/DUK_USE_STRHASH_DENSE.yaml
  2. 12
      config/config-options/DUK_USE_STRHASH_SKIP_SHIFT.yaml
  3. 2
      config/examples/performance_sensitive.yaml
  4. 4
      config/examples/security_sensitive.yaml

10
config/config-options/DUK_USE_STRHASH_DENSE.yaml

@ -0,0 +1,10 @@
define: DUK_USE_STRHASH_DENSE
introduced: 1.4.0
default: false
tags:
- performance
- sandbox
description: >
Use the slower but more dense string hash algorithm from Duktape 1.3.0 and
prior (based on Murmurhash2). This may be useful if you're experiencing
collision issues with the default hash algorithm.

12
config/config-options/DUK_USE_STRHASH_SKIP_SHIFT.yaml

@ -0,0 +1,12 @@
define: DUK_USE_STRHASH_SKIP_SHIFT
introduced: 1.4.0
default: 5
tags:
- performance
description: >
Shift value to use for string hash skip offset when using the default
(fast) string hash. The skip offset is calculated as:
((length >> DUK_USE_STRHASH_SKIP_SHIFT) + 1). A higher value will be
slower but sample the string more densely.
You should only change this if you run into issues with the default value.

2
config/examples/performance_sensitive.yaml

@ -15,4 +15,6 @@ DUK_USE_JSON_DECNUMBER_FASTPATH: true
DUK_USE_JSON_EATWHITE_FASTPATH: true
DUK_USE_INTERRUPT_COUNTER: false
DUK_USE_DEBUGGER_SUPPORT: false
DUK_USE_STRHASH_DENSE: false
DUK_USE_STRHASH_SKIP_SHIFT: 5 # may be able to reduce
#DUK_USE_EXEC_FUN_LOCAL: test both values, marginal benefit

4
config/examples/security_sensitive.yaml

@ -10,4 +10,8 @@ DUK_USE_VERBOSE_PROP_ERRORS: false
# code).
DUK_USE_TRACEBACKS: false
# Dense string hashing may be useful against accidental string hash collisions.
# This won't prevent an attacker from finding intentional collisions.
DUK_USE_STRHASH_DENSE: true
# TBD

Loading…
Cancel
Save