sarim / ibus-avro

Avro phonetic bangla typing layout for ibus
Mozilla Public License 2.0
241 stars 92 forks source link

ibus-avro gets extremely slow on Ubuntu 12.04 when typing fast #34

Open kaustavdm opened 12 years ago

kaustavdm commented 12 years ago

System: Ubuntu 12.04 desktop 32 bit, Intel Atom 1.6 GHz processor, 1GB RAM, Unity 2D desktop environment

ibus-avro installs fine, works across applications but gets very slow when I start writing even faintly fast. After two or three words, ibus-avro begins mixing up keystrokes, resulting in faulty words, and often not converting a number of keystrokes to Bangla. FYI, phonetic typing in Hindi works fine on the same system.

sarim commented 12 years ago

Open up terminal and run top , place the terminal window beside gedit and try to write using avro, check CPU% when avro is getting slow.

TAG: @omicronlab

omicronlab commented 12 years ago

That's odd. Because in my (non-scientific) tests it could compete with equivalent Delphi or Objective-C compiled codes under Windows or Mac OS X, and I ran it in a virtual machine with limited resource. There is also a very basic caching so that ibus-avro doesn't lookup previously searched suggestions again. Can you please check if that works (whether repeatedly typing same word remains as slow as you mentioned)?

Also, does it get slower with time? That might be a issue with cache getting too big. Memory used by ibus-avro process won't reveal much. Can you please check how much memory gjs is using?

Does turning dictionary feature off improve the situation?

@sarim Should we move to v8?

sarim commented 12 years ago

After seeing this, i guessed the regex could be bottleneck.We may use GLib.Regex instead of gjs(spidermonkey)'s javascript regex. But i run a small hand test and when writing quickly, ibus-daemon takes 40% CPU and gjs takes 20% CPU in my 2GHz Dual core laptop. So switching to v8 wont help much i think. ibus-daemon taking 40% cpu is not acceptable, we need to optimize that first. Then we may split the code parts and run tests to find out the cause.

omicronlab commented 12 years ago

Of course regex is the bottleneck. But during my test each regex search took less than 18ms. Pressing a key initiates a new search (if it is not available in the cache), so complete processing should be done instantly.

I cannot comment on benefits of using GLib.Regex until I test. But common sense says marshaling JavaScript object (dictionary array) to and from glib would impose additional overhead. Can you please look into it @sarim? I'm pretty packed right now :(

s-m-saifullah commented 12 years ago

In my Intel Celeron D 2.13 GHz processor and 768MB Ram IBus-Avro is running too slow with dictionary on. But it works fine without dictionary. The problem is exactly same that kustavdm noted. I am using Ubuntu 12.04.

sarim commented 12 years ago

hmm, i'm looking into this issue.