Slow Find & Replace

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Slow Find & Replace

Post by MikeyB »

Good morning.

I have noticed in the past that Find & Replace is not particularly quick with larger files when lots of replaces take place, but have just come across a very good example of just how slow it can be.

I have a 1.8MB xml file with 6175 lines from one system that I have to import into another system, but I have to make a change to each line in order for the import to work.

Each line/node starts:

Code: Select all

<report district="CBC" cat="FHY" from="
But I have to change that to:

Code: Select all

<item district="CBC" cat="FHY" from="
Not a big change, but it won't import otherwise!

Loaded the XML file into WeBuilder 9.1.0.98, Search -> Replace. Put <report into "Search for" and <item into "Repalce with"
None of the "Options" are ticked, Direction is forward, Scope current document, and Origin is From Cursor as I'm at the top of the document.

Clicked Replace All and waited...

I originally thought WeBuilder had hung so I ended the task and tried again, the same.

So again I thought I'd wait, see what happens, and eventually it started to do the Find & Replace.

I did some timings, after clicking "Replace All" it took 1m:12s before WeBuilder started to do anything at all, it then took a further 2m:09s to do the replacing, totalling 3m:21s to do 6172 replaces.

I'm not sure what is going on to start with when "nothing" is happening, but when the Find & Replace is happening it is scrolling through the file at each match, in this case every line, so I would guess that slows it down considerably.

I tried again, this time renaming to a .txt file so there was no code highlighting, and turned off things like "Highlight focused line" but it made no difference to the speed.

I know this is a rather extreme Find & Replace to do but my other editor, which I used before I found WeBuilder, can do the same in under half a second!

I've uploaded a zipped copy of the file to http://swindonmike.googlepages.com/slowfind%26replace so anyone willing to can try it for themselves!

It's not every day that I do such large Find & Replaces but I have noticed that this function is always slower than other editors.

Cheers,
Mike
User avatar
chrisjlocke
Top Contributor
Posts: 995
Joined: Mon Aug 01, 2005 4:12 pm
Location: Essex, UK
Contact:

Re: Slow Find & Replace

Post by chrisjlocke »

Yup, I can replicate that on my system (WB 2008 with XP). Interestingly, clicking 'Replace' on its own is quite quick - replaces it and finds the next one easily enough, so its weird where the delay is coming from. Holding down ALT & R (Replace) is slow though.

I don't see it working once I click 'Replace All' - just a delay until its finished. Its consistently using 50% CPU all that time.
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: Slow Find & Replace

Post by MikeyB »

Hi,

Didn't think of looking at the CPU usage etc.

Load WeBuilder with no documents, load the large XML file.
Memory usage is 49,204K, CPU 0%

Start the Find & Replace, CPU jumps and stays at 50%
Memory usage climbs up to roughly 146,000K while I get the "delay"
Then when the Find & Replace starts to move through the document mem usage drops al ittle to 142,000K and then slowly grows a to about 144,000K.
CPU is 50% throughout.

Suddenly drops down to 54,820K once the Find & Replace is completed.

Mike
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Re: Slow Find & Replace

Post by Gatis »

Hi,
We have figured out how to improve the speed of the Replace All command. It will be much quicker now on large files!
The fix will be available with next version update.
Kind regards,
Gatis Avots
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: Slow Find & Replace

Post by MikeyB »

Hi Gatis,

Great news, thanks for working on this.

That's the great thing about you guys, actually listen to people on the forums.

Cheers,
Mike
Post Reply