Comments (9)
I came across this when searching for other projects having issues with GetIdentityHash
. Circling back around just to say that I found out it's only 21 bits now, so we in another project were having issues with collisions in just hundreds of instances.
from rusty_v8.
Ok thanks - good to know.
from rusty_v8.
Hi! Is there an estimate on this issue? We're using GetIdentityHash() to identify objects, and we would like to know if we can rely on it or not.
from rusty_v8.
@zbendefy I've had no problems with it.
from rusty_v8.
@ry We'll use potentially thousands of objects, that we are identifying (for storage in a hashmap) using GetIdentityHash(). We didn't do thorough testing yet, but having a Stable way to identify JS objects would be nice.
I presume that we cannot use the underlying pointer values behind a Local<> or Persistent<> handle?
from rusty_v8.
@ry Is this still relevant?
from rusty_v8.
Yes
from rusty_v8.
These bindings are now in rust_v8
so I moved it.
from rusty_v8.
This is not for rusty_v8 to fix. The identity hash itself isn't buggy but it can be used in a way that introduces bugs.
To summarize:
-
An object's identity hash is a 21 or 22 bits random number (on 32 and 64 bits architectures respectively)
-
Per the Birthday Paradox, that means the chance of a collision is > 50% with approx. 1700 or 2400 objects.
You can use it to store objects in a hashmap but you need to additionally check with a.same_value(b)
if the object already exists in the hashmap bucket.
from rusty_v8.
Related Issues (20)
- Enable V8 builtins PGO optimization
- Add v8::MicrotaskQueue bindings
- `v8::MessageCallback` registered but not called
- Add "v8::Object::get_real_named_property_*" methods
- Missing v8::MicrotaskQueue::new() binding
- Missing v8::Context::new() options
- ICU Error in DateTimePatternGeneratorCache::CreateGenerator HOT 1
- [Feature request] Support for Linux PowerPC64 Little Endian
- V8 Sandbox feature HOT 8
- ASAN failure: context_from_object_template HOT 2
- API to create and re-use StartupData HOT 4
- [Bug Report]: Static assertion failed while compiling to target_arch = arm
- [question] How do scopes work? HOT 3
- Unsoundness when starting an isolate per thread HOT 6
- ci: x86_64 build failed on macos-latest image HOT 2
- `v8::String::new_from_onebyte_const` crash on Android aarch64 HOT 7
- Failed to build V8 on riscv64
- Use of deprecated APIs in binding.cc
- `clear_kept_objects` is flaky when run in parallel HOT 1
- Property setter and definer should not return "non-hole" values HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rusty_v8.