Giter Site home page Giter Site logo

Collision and performance issue about short-url HOT 7 CLOSED

hari avatar hari commented on July 16, 2024
Collision and performance issue

from short-url.

Comments (7)

ash-jc-allen avatar ash-jc-allen commented on July 16, 2024 1

Hey @hari!

Thank you for the kind words, I really appreciate it! 😄

The performance issues for larger apps is something that seems to be popping up quite a lot, so I feel like this is something I'm definitely going to have to look at.

In all honesty, when I first made this package, I didn't expect that anyone was going to use it. I definitely didn't expect it to be used in larger apps with 1k+/10k+/100k+ short URLs haha! So there are some decisions I made when building it that didn't really think too much about performance because it wasn't really on my mind at the time.

Case-sensitivity is something that I'd never considered and I think that'll explain a lot of other people's issues too! I'd definitely be open to a PR for that!

With regards to the using max(), can you see this causing any issues at all? I think I like the idea of switching over to this, but I'm just trying to think if it'd cause any problems for existing apps using the package? Either way, I think I'd be open to a PR for this 😄

In the near future, I'm intending on using an interface for the key generator class too. I'll be making this part of the package configurable so that you can swap out for your own implementation to generate the keys if the package's default implementation doesn't fit your apps use case anymore. I'm hoping this will make things a lot more flexible 🙂

from short-url.

ash-jc-allen avatar ash-jc-allen commented on July 16, 2024 1

Sweet! I'm in the process of getting my new book released (release date is 3rd October), so I doubt I'll be able to look at the PRs before that date, so there's no rush to make them 🙂

from short-url.

hari avatar hari commented on July 16, 2024

Thank you for the response @ash-jc-allen. Switching to max() shouldn't cause any issues as it is just making a native SQL call.

I will submit 2 PRs this week.

from short-url.

hari avatar hari commented on July 16, 2024

Hi @ash-jc-allen

I was wondering how the migration should be added for this change. I read your comment in another PR regarding modifying the existing migration for the base table. Should we do that or add a new migration for changing the column's collation?

Thank you

from short-url.

ash-jc-allen avatar ash-jc-allen commented on July 16, 2024

Oooh that's a good question! For similar reasons mentioned in the comment you linked to, I'd be tempted to only make the changes in existing migration. Or if there's any performant way to handle this in the package's code without touching the database (I don't know if that's possible), then I'd be open to that too 🙂

from short-url.

avivsalman avatar avivsalman commented on July 16, 2024

Hi @hari & @ash-jc-allen ,

if you are on performence issues, so i just want to give you one more thing that i saw, each generate of new key, there is 2 database query of the model exist function, i think that it need to be only once.

from short-url.

ash-jc-allen avatar ash-jc-allen commented on July 16, 2024

Hey @avivsalman! I'm always open to reviewing any PRs that can help to improve the performance of the package, if you fancy making one? 😄

from short-url.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.