-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[12.x] Replace md5 with much faster xxhash #52301
Conversation
What about
|
No, that is intentionally omitted, and should not be changed. |
We would need to note in the upgrade guide that on the first deploy of an upgraded Laravel 12 app it will reset active rate limiters. Could be important for applications. It could allow unexpected behaviour within the application if you are using rate limiters to restict business logic, e.g., you can only create 10 invoices per month. |
Alternatively, I could also revert that portion of this PR, if we don't want this upgrading step. |
FWIW we already use
framework/src/Illuminate/View/Component.php Line 201 in 8ca1b5b
|
Agree with @timacdonald we probably only want to do this where it isn't "breaking" in the sense of resetting rate limiters, etc. |
I like the idea of swapping to a more efficient hash. Also gets rid of more uses of MD5! 😁 One idea to avoid the breaking change issue is to define the hashing algo in a config file. Both algos can be used through |
Maybe, It is better to default to |
There is negligible performance benefit for the choice of hashing algorithm for the cache key for throttling. The cost of reading the config and checking it will be more than the performance gain of changing the algorithm for hashing like 10 bytes of data. |
OK, I've rolled back the rate limiter change. I think the etag change is low impact and is the place in this PR where we will see the main performance benefit. I think we should note this change in the upgrading guide. |
* Switch DefaultHasher to xxh128 for a faster alternative to MD5. - See https://xxhash.com/ - Laravel is considering replacing MD5 with xxh128: laravel/framework#52301 * Update ResponseHasherTest to reflect xxh128 algorithm changes
In particular, this may make a noticeable difference for the etag content hashing. md5 doesn't really have a purpose in 2024: xxh128 is much faster and produces the same size hash as md5.