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.
GPGurucharan Patwal Syncfusion Team December 4, 2003 05:10 PM
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.
DLDavid LoomesDecember 5, 2003 03:32 AM
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.
GPGurucharan Patwal Syncfusion Team December 5, 2003 03:26 PM
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.
DLDavid LoomesDecember 6, 2003 12:03 PM
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.
GPGurucharan Patwal Syncfusion Team December 8, 2003 02:15 PM
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.
MEMarco EnsingFebruary 2, 2004 01:22 PM
What is the current status on this issue with respect to the lattest release
ADAdministrator Syncfusion Team February 3, 2004 03:49 PM
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.
MEMarco EnsingFebruary 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.
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
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
foreach (string item in terms)
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);
//For quick testing
FileStream fs = new FileStream(@"C:\RESULT.INI", FileMode.OpenOrCreate);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.Default);
memoryStream.Position = 0;
And the EditControl is initialized with
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.
ADAdministrator Syncfusion Team February 5, 2004 04:16 PM
Thanks for sharing this information with us. We apreciate your continued interest in Syncfusion products.