I''ve been trying to speed up my program, which uses a TextCtrl, for large files by getting rid of code using line numbers. However, it seems that just using the get_range method is slowing down my program for large files. I don''t know whether I''m doing something wrong or there''s a way to access the text without significant slowing in large files. If anyone can help, I''d very much appreciate it. Thanks, Ross Goodell -- Posted via http://www.ruby-forum.com/.
Hi Ross Goodell wrote:> I''ve been trying to speed up my program, which uses a TextCtrl, for > large files by getting rid of code using line numbers. However, it > seems that just using the get_range method is slowing down my program > for large files. I don''t know whether I''m doing something wrong or > there''s a way to access the text without significant slowing in large > files.What ruby version and platform are you working on? You might be able to optimise by pulling out larger sections of text at one go and working on them in Ruby. There''s an inherent overhead with each call to the Wx API: where it cross the Ruby / C++ boundary new strings have to be created and converted. Also you could try using Wx::StyledTextCtrl which is a code-oriented editor. Its API should be a drop-in replacement for TextCtrl, and it may be better optimised for the kind of task you''re using it for. a