4 ms·
Which is fine when you're doing nothing but a simple operation on a string, then reencoding it. Seriously, how many strings have you ever ran across that are m
by bumblebritches5 8y ago
Which is fine when you're doing nothing but a simple operation on a string, then reencoding it.
Seriously, how many strings have you ever ran across that are more than 1kb?
how many strings have you ran across that are more than 256 codepoints?
- steveklabnik 8y agoSure. It's fine sometimes, and not fine other times. That's why it's called a tradeoff. I see strings larger than that all the time, and care about using low RSS. YMMV.
- nirvdrum 8y agoPeople routinely read text files larger than 1 KB into memory. HTTP responses are often larger than 1 KB. Serialized data (JSON, XML, etc.) is often larger than 1 KB.
- bumblebritches5 8y agoHTTP headers are not anywhere near 1kb of text. the packet's themselves are only 1.5kb.
- nirvdrum 8y agoThe headers are one component of a response. The body is often larger than 1 KB.
- bumblebritches5 8y agoand your whole packet is text, without any compression? I doubt that.
- mromanuk 8y agoI’m currently working with a 2 MB string, representing 150k words, with a structure that is a Packed Trie stored as an array for fast access of Unicode Scalars in Swift
- bumblebritches5 8y agoWhy would you use a string to store that in the first place? if you're editing text, make a structure that contains just words, sentences, paragraphs with smaller more manageable strings in there. There's no reason for a single string to contain that much data.