You are not logged in.

#1 2009-05-06 13:33:14

chochem
Member
From: Denmark
Registered: 2008-03-02
Posts: 176
Website

[SOLVED] Colour coding XML eats up CPU !?

I'm trying to edit a 365 kb XML file in various GTKeditors (medit, gedit, geany,...) but I'm slightly baffled by how the simple task of colour coding can slow the editing to a halt. Runing htop in a window beside the editor I can see that scrolling whether up/down or jsut sideways (not retrieving new lines) will set the cpu in Performance mode and eat up all of my 2.0GHz! Saving the same file as a text file or turning off colour coding makes the problem go away.

I kinda need colour coding to amke sense of the thing but it's like editing in treacle. Does anybody else get this and/or have any suggestions? I'm assuming that it's just badly coded cause surely the task isn't all that complicated?

Last edited by chochem (2009-05-06 22:51:48)

Offline

#2 2009-05-06 14:25:27

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] Colour coding XML eats up CPU !?

The main problem is that most XML editors are required to parse and in some kind interpret the file contents in order to color code. In most implementations it is necessary to read a whole tag sequence from its starting <tag> to its ending </tag>. This requires lots of memory and processing power.

Nevertheless, using up all cpu is somewhat unusual, unless your XML file is very deeply structured.

Last edited by bernarcher (2009-05-06 14:26:30)


To know or not to know ...
... the questions remain forever.

Offline

#3 2009-05-06 15:47:40

chochem
Member
From: Denmark
Registered: 2008-03-02
Posts: 176
Website

Re: [SOLVED] Colour coding XML eats up CPU !?

bernarcher wrote:

The main problem is that most XML editors are required to parse and in some kind interpret the file contents in order to color code. In most implementations it is necessary to read a whole tag sequence from its starting <tag> to its ending </tag>. This requires lots of memory and processing power.

Nevertheless, using up all cpu is somewhat unusual, unless your XML file is very deeply structured.

I see what you mean... I can't really say - it was a mac .pages file that I found that I could edit by unzipping the contents and then editing the raw innards. I've put it up here: index.xml

Offline

#4 2009-05-06 20:15:54

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] Colour coding XML eats up CPU !?

I got it. The file consist of one single line only. If you insert newlines between each "><" it should be easily editable.
I did convert it in vim, using

:%s#><#>^M<#g

where the  ^M must be input as control character (ctrl-v, <enter>).


To know or not to know ...
... the questions remain forever.

Offline

#5 2009-05-06 22:51:20

chochem
Member
From: Denmark
Registered: 2008-03-02
Posts: 176
Website

Re: [SOLVED] Colour coding XML eats up CPU !?

of course... I had just got used to switching on text wrapping that I didn't even think about anymore. Thanks for your help, bernarcher.


(oh and I'll take sed over vim any day, thankyouverymuch wink )

Offline

Board footer

Powered by FluxBB