You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the one-file current approach with a multiple files approach, using hash for names, in a similar way to what Apple is doing with MacOS internal files (would reduce the load time, make eviction easier to manage)
The text was updated successfully, but these errors were encountered:
Looks like the first thing to do is storing hashes. Copying and testing the post from stackoverflow, this works. We should perhaps keep bytes; strings are only for human inspection.
importjava.security.MessageDigestimportjava.util.HexFormatobjectTest:valbytes=MessageDigest.getInstance("SHA-256")
.digest("any string".getBytes("UTF-8"))
@main
defsha256:Unit=vals=HexFormat.of().formatHex(bytes)
println(s)
// 1e57a452a094728c291bc42bf2bc7eb8d9fd8844d1369da2bf728588b46c4e75// same as output of:// echo -n "any string" | openssl dgst -sha256
Someone could also write a dedicated hash table for storing fixed-length caches in a bytearray or long array. It should be notably faster than Hashmap, as we only need one bytearray to store hashes, and use the ending of the hash multiplied by some costant (by 32 if we have byte array) to index into this array.
Here are some ideas to improve the Stainless cache implementation to improve its performance and reduce its footprint:
see: https://stackoverflow.com/questions/46329956/how-to-correctly-generate-sha-256-checksum-for-a-string-in-scala/46332228#46332228
The text was updated successfully, but these errors were encountered: