Comments (4)
The two functions at fault are:
https://github.com/bumptech/glide/blob/master/library/src/com/bumptech/glide/resize/ImageManager.java#L627
https://github.com/bumptech/glide/blob/master/library/src/com/bumptech/glide/util/Util.java
The underlying reason for this bit of ugliness is that the disk cache implementation throws an exception if keys don't match the regex [a-z0-9_-]{1,64}. At some point someone has to be responsible for normalizing keys that don't match.
The Util.hash function should be improved and should probably return a 64 digit number rather than a 10 digit 32 bit integer which will help reduce collisions. Since the disk cache doesn't handle key collisions, we can't ever entirely solve this problem, but we should be able to make it very rare.
I just started a new job so I'm short on time, but if this seems reasonable to you I'll try and get something better up this week.
from glide.
Seems ok, I saw a discussion in SO about functions to calculate a better hash in a disc cache to avoid collisions but also improve the speed of the calculation. I think UUID was the winner but I'm not sure.
from glide.
Here it is:
- http://stackoverflow.com/a/16897129
- http://stackoverflow.com/questions/772802/storing-uuid-as-base64-string/18057117#18057117
Another possibility would be:
- get the hashcode, convert it to 64, do a XOR|OR with the first/last X chars of the URL and convert to HEX
- Base64 of the URL
from glide.
I saw your comment as I was finishing up something using sha-256. I'll take a look at the uuid questions. If it's a trade off between speed (uuid) and correctness (sha-256, 64 characters vs 32 for uuid), I'd probably rather use aggressive caching and be a bit slower the first time around.
I took a look at trace view and for uncached keys using sha-256, it took about 70ms to generate the keys for 26 or so different images. At 2-3ms per image, it's not a substantial performance hit.
from glide.
Related Issues (20)
- crash for glide-source-th
- Compose GlideImage doesn't work property with drawWithCache modifier HOT 1
- SVG rendering issues
- OutOfMemoryError
- Big PNG can't be decoded: Mark has been invalidated
- GlideImage no longer works with Modifier.weight()
- Caused by: java.lang.ArrayIndexOutOfBoundsException: src.length=4 srcPos=-1 dst.length=4 dstPos=0 length=1
- Drawable Resources are not properly loaded when resource names are stripped out from Resource Table HOT 3
- Glide override not working with avif images.
- Consider implementing contentScale in Compose without using Transformations
- Glide Compose: java.lang.IllegalArgumentException caused by sideEffect run asynchronously
- Unable to build project in Android Studio Jellyfish HOT 2
- Not able to load svg image. Showing blank screen HOT 1
- how fix glide 3.8 GlideModule do not work. HOT 1
- Load Drawable can block main thread for over 1 second
- Compose: rememberGlidePreloadingData not preload, but use higher memory.
- WebpDrawable is not rendering last frame
- Loading local images thumbnails
- Inconsistent screenshot-testing with paparazzi and GlideImage composable
- error(R.drawable.xxxx) and placeholder(R.drawable.xxxx) do not work in glide HOT 1
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 glide.