Skip to content
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

Use a hash function as the basis of a random string #997

Merged
merged 2 commits into from
May 21, 2024

Conversation

realodix
Copy link
Owner

@realodix realodix commented May 21, 2024

Previous #992

The random string generator method is very slow, so the simpleString method (30x faster) was created to reduce the use of the random string generator method.

But the method is too simple. Only 2 unique strings can be generated by the simpleString method, all others must use the random string generator method.

// Only 2 unique strings

['ravel', 'https://github.com/laravel/laravel'],
['ravel', 'https://stackoverflow.com/questions/tagged/laravel'],
['ravel', 'https://www.youtube.com/hashtag/laravel'],
['ravel', 'https://www.reddit.com/r/laravel/'],
['ravel', 'https://dev.to/t/laravel'],
['ravel', 'https://laracasts.com/topics/laravel'],
['ravel', 'https://laravel.io/forum/tags/laravel'],
['ravel', 'https://medium.com/tag/laravel'],
['ravel', 'https://fontawesome.com/icons/laravel'],

['ravel', 'https://en.wikipedia.org/wiki/Laravel'],
['ravel', 'https://id.wikipedia.org/wiki/Laravel'],

['ework', 'https://github.com/topics/framework'],
['ework', 'https://github.com/laravel/framework'],
['ework', 'https://github.com/codeigniter4/framework'],
['ework', 'https://github.com/spring-projects/spring-framework'],
['ework', 'https://github.com/ionic-team/ionic-framework'],

With this PR, we can further reduce the usage of random string generator.

['2fd03', 'https://github.com/laravel/laravel'],
['bc6c5', 'https://stackoverflow.com/questions/tagged/laravel'],
['9d3cb', 'https://www.youtube.com/hashtag/laravel'],
['048fd', 'https://www.reddit.com/r/laravel/'],
['42ab4', 'https://dev.to/t/laravel'],
['dc009', 'https://laracasts.com/topics/laravel'],
['6cecf', 'https://laravel.io/forum/tags/laravel'],
['4ba17', 'https://medium.com/tag/laravel'],
['09e5d', 'https://fontawesome.com/icons/laravel'],

['7b418', 'https://en.wikipedia.org/wiki/Laravel'],
['59c7d', 'https://id.wikipedia.org/wiki/Laravel'],

['ff45f', 'https://github.com/topics/framework'],
['40b70', 'https://github.com/laravel/framework'],
['be785', 'https://github.com/codeigniter4/framework'],
['0027d', 'https://github.com/spring-projects/spring-framework'],
['eea5d', 'https://github.com/ionic-team/ionic-framework'],

@realodix realodix changed the title Improve simple string generator method Use a hash function as the basis of a random string May 21, 2024
@realodix realodix merged commit 2ebba15 into master May 21, 2024
3 checks passed
@realodix realodix deleted the ref-simplestring branch May 21, 2024 09:45
realodix added a commit that referenced this pull request May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant