Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm editing a JSON formatted text file in Mac OS X Mountain Lion (10.8.2) on a 2.3 GHz Intel Core i7 with 8 GB of RAM.

The file is approx. 3 MB large so it's not very big. Anyhow this is making both TextEdit and Coda 2 to use 100% CPU. I really do not understand what is causing this behavior.

File in question: download link

share|improve this question
Are there really, really long lines in that text? Could be the cause. – Desmond Hume Feb 26 '13 at 14:55
No not at all, this is very interesting, I just tried open the file with TextWrangler and the same issue, 100%... maybe I should upload the file and you can have a look at it... – Peter Warbo Feb 26 '13 at 15:08
Okay, go ahead. – Desmond Hume Feb 26 '13 at 15:17
Added download link in question... – Peter Warbo Feb 26 '13 at 15:31
up vote 3 down vote accepted

As I expected, your JSON file contains an extremely long line at the end due to some sort of corruption. The line mostly consists of white spaces.

share|improve this answer
Aha, how did you spot it? But I don't understand how whitespace can make the CPU go 100%? Btw, how are you using Amazon to share files? :) – Peter Warbo Feb 26 '13 at 16:13
It could be that most text rendering engines (or even text editors) are optimized in a way that prevents them from fast digesting/displaying very long lines. As for Amazon, I was using Amazon S3 service, here are the links Amazon S3, AWS Free Usage Tier. – Desmond Hume Feb 26 '13 at 16:28
Btw how did you "clean" the file? – Peter Warbo Feb 27 '13 at 9:36
@PeterWarbo Well, I opened it in Sublime Text, deleted that massive whitespace at the end, removed trailing spaces from every line using regular expressions (trailing spaces are redundant in JSON), and added one missing ] at the end. – Desmond Hume Feb 27 '13 at 10:19
Ah Sublime Text worked beautiful, all other text editors I've tried choked on the file for some reason, what does that regex look like to delete trailing whitespace? (but keeping newlines) – Peter Warbo Feb 27 '13 at 10:34

Try to turn off the coda syntax highlighting feature in edit menu, because the coda try to keep syntax highlighting and the file is too big for this. I think.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .