Displaying 3 results from an estimated 3 matches for "obj_hash".
Did you mean:
db_hash
2024 Jan 17
1
Choices to remove `srcref` (and its buddies) when serializing objects
...on the fly without any
> serialization, similarly to how identical works, but I am not aware of
> any existing implementation
We have one in vctrs but it's not exported:
https://github.com/r-lib/vctrs/blob/main/src/hash.c
The main use is vectorised hashing:
```
# Non-vectorised
vctrs:::obj_hash(1:10)
#> [1] 1e 77 ce 48
# Vectorised
vctrs:::vec_hash(1L)
#> [1] 70 a2 85 ef
vctrs:::vec_hash(1:2)
#> [1] 70 a2 85 ef bf 3c 2c cf
# vctrs semantics so dfs are vectors of rows
length(vctrs:::vec_hash(mtcars)) / 4
#> [1] 32
nrow(mtcars)
#> [1] 32
```
Best,
Lionel
On Wed, Jan 17, 2...
2024 Jan 18
0
Choices to remove `srcref` (and its buddies) when serializing objects
...t functions that come into my mind. Both are widely used, but they use serialize. The author of `digest` said:
>
> > "As you know, digest takes and (ahem) "digests" what serialize gives it, so you would have to look into what serialize lets you do."
>
> vctrs:::obj_hash is probably the closest to the implementation of `identical`, but the above examples give different results for identical objects.
>
> The existence of digest:: digest and rlang::hash shows that there is a huge demand for this "ideal" hash function. However, I bet most people are u...
2024 Jan 17
1
Choices to remove `srcref` (and its buddies) when serializing objects
On 1/16/24 20:16, Dipterix Wang wrote:
> Could you recommend any packages/functions that compute hash such that
> the source references and sexpinfo_struct are ignored? Basically a
> version of `serialize` that convert R objects to raw without storing
> the ancillary source reference and sexpinfo.
> I think most people would think of `digest` but that package uses
>