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
Roadmap #15
Comments
How about a Rope? I will try to find time to implement one if you're ok with it. |
Sure @vmasto. Why not. I just have one concern: how do most JavaScript engines implement their strings. The problem is that the native string is probably optimized to do what a rope can do and will probably do it better. But this is just an intuition I have, this is not backed by any benchmark. However, if your rope is able to support sequences of arbitrary elements (not just a string of characters but, say, a list of words) then yes, it would probably be useful. What do you think? |
I am under the impression that native strings have O(n) complexities when it comes to insert, delete and concat whereas a Rope would give us O(m) (where m is the substring's length to be inserted/del/concat) with the caveat that we'll lose random access in constant time. Thus a Rope would be suitable for frequent text manipulation (e.g. a text editor?). It's a good point though and I'll have to verify what I'm saying here since string implementation changes from engine to engine. I'll get back to you on this. Another concern is that rope implementations most probably already exist around and maybe it'd be of more value to contribute with a more exotic data structure, although my experience is limited on those. |
The text was updated successfully, but these errors were encountered: