We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Adding keywords very slow

Thread ID:

Created:

Updated:

Platform:

Replies:

9064 Dec 4,2003 06:18 AM Feb 5,2004 04:16 PM Windows Forms 9
loading
Tags: EditControl
David Loomes
Asked On December 4, 2003 06:18 AM

I''ve been using the Addkeyword method to add syntax highlighting dynamically, and find that this method seems to take an unreasonable amount of time. Inserting say 130 keywords takes around 10 seconds even on a 3GHz machine. Strangely, adding the same keywords a second time takes virtually no time. Is the control performing some sort of horrible insertion sort? Is there a way to stop it until all the keywords have been loaded? Is there a quick way to remove all keywords, or do I have to remove them one at a time? Thanks for any advice. David Loomes

Gurucharan Patwal [Syncfusion]
Replied On December 4, 2003 05:10 PM

Hi David, We are unable to be specific, but one of the possible reasons could be that EditControl "refreshes" it''s internal data structures for each Add and Remove keywords call. Looks like a "suspend refresh" property will be of a big help in the EditControl. We will try our best to add such a property in our future releases. Regards, Guru Patwal Syncfusion, Inc.

David Loomes
Replied On December 5, 2003 03:32 AM

Guru, Thanks for the info. I did some more testing and I''m afraid the figures aren''t very good. Adding the first 5 keywords takes around 30ms on a 3.2GHz P4! As keywords are added, the time to add each new one rises linearly, so that by the time there are 100 keywords, adding another 5 to the list takes 300ms. Once the list has reached 130, each new keyword requires >100ms. The net result is the time taken to build a keyword list with N entries increase with N^2. The order in which the keywords are added makes no noticeable difference. I''m afraid this behaviour isn''t terribly useful. David Loomes

Gurucharan Patwal [Syncfusion]
Replied On December 5, 2003 03:26 PM

Hi David, Thanks for the additional information. We do realise that this needs to be addressed at the earliest and have considered it as a high priority issue. I will keep updated regarding the developments as we investigate this. We appreciate your patience and understanding in this matter. Regards, Guru Patwal Syncfusion, Inc.

David Loomes
Replied On December 6, 2003 12:03 PM

Guru, a related problem. To get round the time taken to add keywords, I tried generating a complete INI file dynamically, and using the ''FromStream'' function to load the stream. This works with the required speed, but extended characters (Chinese, Japanese etc) are not recognised. Odd, since they work correctly if added individually via AddKeyword. It would be nice if your guys could sort this out too. David Loomes

Gurucharan Patwal [Syncfusion]
Replied On December 8, 2003 02:15 PM

Hi David, Thanks for your feedback on these finer issues. We will look into the problem in handling the extended characters as well. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal. Syncfusion, Inc.

Marco Ensing
Replied On February 2, 2004 01:22 PM

What is the current status on this issue with respect to the lattest release Marco

Administrator [Syncfusion]
Replied On February 3, 2004 03:49 PM

Hi Marco, I have requested the development team for information on the status of this issue, and will update you as soon as they get back to me. Thanks for your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.

Marco Ensing
Replied On February 5, 2004 03:20 PM

I''ve implemented the suggested workaround as a memory stream. Works great. No complaints. But I can image that new users might find the writing of the workaround cumbersome. Here is the code for anybody out there looking for it: Create a default .ini file and compile it into the assembly as a resource. assume: Terms.ini file has your initial settings. executingAssembly = Assembly.GetExecutingAssembly(); internal System.IO.Stream ExtendIniFile(System.Collections.ICollection terms) { System.IO.Stream iniStream = executingAssembly.GetManifestResourceStream("YourAssembly.Terms.ini"); //Build the extension string extension; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); foreach (string item in terms) { stringBuilder.AppendFormat("Keyword={0}\n", item); } extension = stringBuilder.ToString(); //Memory stream is initial lenght + extension System.IO.MemoryStream memoryStream = new System.IO.MemoryStream((int) iniStream.Length + (int) extension.Length); System.IO.BinaryReader reader = new System.IO.BinaryReader(iniStream); byte[] buffer = reader.ReadBytes((int) iniStream.Length); memoryStream.Write(buffer, 0, (int) iniStream.Length); byte[] buffer2 = System.Text.Encoding.Default.GetBytes(extension); memoryStream.Write(buffer2, 0, (int) extension.Length); memoryStream.Flush(); //For quick testing FileStream fs = new FileStream(@"C:\RESULT.INI", FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default); memoryStream.WriteTo(sw.BaseStream); sw.Close(); memoryStream.Position = 0; return memoryStream; } And the EditControl is initialized with this.editControl1.UseSettingStream(this.resourceHandler.ExtendIniFile(dataService.getTermLookupTable().Keys)); I don''t know too much about streams but it does the Job. I''m not too sure yet about the used encoding and if that influences the editControl. Regards, Marco

Administrator [Syncfusion]
Replied On February 5, 2004 04:16 PM

Hi Marco, Thanks for sharing this information with us. We apreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;