Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is that a standard immutable string? Does this mean allocating a whole new string every time a character edit is made?


Yes, thanks god for the garbage collector. Although this is JavaScript so I see it as a mutable string.


I don't understand? Strings in JS are immutable. There's no way to mutate them.

Using strings like this will thrash your garbage collection, especially with long lines. An array, or more interesting data structure, might be more sensible.

(only pursuing this because I'm interested in your project!)


Sorry, I keep mixing up variables with types. I do not think about types when I program (JavaScript).

You might find my blog interesting: http://webtigerteam.com/johan/en/blog/editor2.htm http://webtigerteam.com/johan/en/blog/editor.htm


Surely not one allocation per key, that could be up to like 10 allocations per second.


You will not notice anything unless you are watching the memory graph. I see no reason for "optimization" at this time.


That's why I asked! (The answer was yes)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: