question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

number parsing is slow, eg "one two three four five six seven eight nine"

See original GitHub issue

Passing of numbers with many spoken components is slow for me. I’d like to know whether anybody else is having this problem. I have tested this on a vanilla checkout of knausj_talon master on the latest beta (v0.1.2-12-gdebaf4e) with w2l gen2 on Ubuntu 20.04. Example tests: say “one two three four five six seven eight nine” or “one million two hundred and thirty four thousand five hundred and sixty seven”. For me it takes a noticeable amount of time to process those, eg see the end of the post for a trace.

One thing that seems to fix it is editing text/numbers.talon to require a ‘number’ prefix:

not tag: user.mouse_grid_showing
-
number <number>: insert("{number}")

but it would be nice not to have to do this.

Example trace:

2020-10-01 23:10:33    IO 
2020-10-01 23:10:35    IO EMIT ['one', 'two', 'thre', 'four', 'five', 'six', 'seven', 'eight', 'nine']
2020-10-01 23:10:35    IO DECODING
detecting in viterbi toks: |||||||||||||||||||||||||||||ooonee|||||twooo|||thrree|||||ffouurrrr||ffiivvve||||ssixxxxx||seevvveen||eighttt|nnniiinnee|||||||||||||
832.144 |||||||||||||||||||||||||||||ooonee|||||twooo|||thrree|||||ffouurrrr||ffiivvve||||ssixxxxx||seevvveen||eighttt|nnniiinnee|||||||||||||
823.666 |||||||||||||||||||||||||||||ooonee|||||twooo|||thrree|||||ffouurrrr||ffiivvve||||ssixxxxx||seevvveen||eighttt|nnniiinnth|||||||||||||
  result: @one @two @thre @four @five @six @seven @eight @nine

2020-10-01 23:10:35    IO DECODED ['@one', '@two', '@thre', '@four', '@five', '@six', '@seven', '@eight', '@nine']
2020-10-01 23:10:37 WARNING [watchdog] "talon.vad.<lambda>" @2.0s
   23:       lib/python3.7/threading.py:890| 
   22:       lib/python3.7/threading.py:926| 
   21:       lib/python3.7/threading.py:870| 
   20:                    talon/cron.py:112| 
   19: ------------------------------------# cron thread
   18:                    talon/cron.py:77 | 
   17:          talon/scripting/rctx.py:200| 
   16: ------------------------------------# 'cron' main:call()
   15:                     talon/vad.py:16 | 
   14:             talon/engines/w2l.py:745| 
   13:      talon/scripting/dispatch.py:98 | 
   12:      talon/scripting/dispatch.py:133| 
   11:      talon/scripting/dispatch.py:124| 
   10:          talon/scripting/rctx.py:200| 
    9: talon/scripting/speech_system.py:42 | 
    8:      talon/scripting/dispatch.py:98 | 
    7:      talon/scripting/dispatch.py:133| 
    6:      talon/scripting/dispatch.py:124| 
    5:          talon/scripting/rctx.py:200| 
    4: talon/scripting/speech_system.py:298| 
    3: talon/scripting/speech_system.py:336| 
    2:         talon/grammar/grammar.py:58 | 
    1:              talon/grammar/vm.py:308| 
2020-10-01 23:10:38 WARNING [watchdog] "talon.scripting.speech_system._redispatch" @2.1s
   27:       lib/python3.7/threading.py:890| 
   26:       lib/python3.7/threading.py:926| 
   25:       lib/python3.7/threading.py:870| 
   24:                    talon/cron.py:112| 
   23: ------------------------------------# cron thread
   22:                    talon/cron.py:77 | 
   21:          talon/scripting/rctx.py:200| 
   20: ------------------------------------# 'cron' user.engines:call()
   19:                     talon/vad.py:16 | 
   18:             talon/engines/w2l.py:745| 
   17:      talon/scripting/dispatch.py:98 | 
   16:      talon/scripting/dispatch.py:133| 
   15:      talon/scripting/dispatch.py:124| 
   14:          talon/scripting/rctx.py:200| 
   13: talon/scripting/speech_system.py:42 | 
   12:      talon/scripting/dispatch.py:98 | 
   11:      talon/scripting/dispatch.py:133| 
   10:      talon/scripting/dispatch.py:124| 
    9:          talon/scripting/rctx.py:200| 
    8: talon/scripting/speech_system.py:298| 
    7: talon/scripting/speech_system.py:336| 
    6:         talon/grammar/grammar.py:58 | 
    5:              talon/grammar/vm.py:314| 
    4:              talon/grammar/vm.py:463| 
    3:              talon/grammar/vm.py:238| 
    2:              talon/grammar/vm.py:202| 
    1:              talon/grammar/vm.py:97 | 
2020-10-01 23:10:38 WARNING [watchdog] "talon.scripting.speech_system.engine_event" @2.4s
   25:       lib/python3.7/threading.py:890| 
   24:       lib/python3.7/threading.py:926| 
   23:       lib/python3.7/threading.py:870| 
   22:                    talon/cron.py:112| 
   21: ------------------------------------# cron thread
   20:                    talon/cron.py:77 | 
   19:          talon/scripting/rctx.py:200| 
   18: ------------------------------------# 'cron' user.engines:call()
   17:                     talon/vad.py:16 | 
   16:             talon/engines/w2l.py:745| 
   15:      talon/scripting/dispatch.py:98 | 
   14:      talon/scripting/dispatch.py:133| 
   13:      talon/scripting/dispatch.py:124| 
   12:          talon/scripting/rctx.py:200| 
   11: talon/scripting/speech_system.py:42 | 
   10:      talon/scripting/dispatch.py:98 | 
    9:      talon/scripting/dispatch.py:133| 
    8:      talon/scripting/dispatch.py:124| 
    7:          talon/scripting/rctx.py:200| 
    6: talon/scripting/speech_system.py:298| 
    5: talon/scripting/speech_system.py:336| 
    4:         talon/grammar/grammar.py:58 | 
    3:              talon/grammar/vm.py:314| 
    2:              talon/grammar/vm.py:463| 
    1:              talon/grammar/vm.py:251| 
2020-10-01 23:10:38 WARNING [watchdog] "grammar(talon_main).parse()" @2.6s
   23:       lib/python3.7/threading.py:890| 
   22:       lib/python3.7/threading.py:926| 
   21:       lib/python3.7/threading.py:870| 
   20:                    talon/cron.py:112| 
   19: ------------------------------------# cron thread
   18:                    talon/cron.py:77 | 
   17:          talon/scripting/rctx.py:200| 
   16: ------------------------------------# 'cron' user.engines:call()
   15:                     talon/vad.py:16 | 
   14:             talon/engines/w2l.py:745| 
   13:      talon/scripting/dispatch.py:98 | 
   12:      talon/scripting/dispatch.py:133| 
   11:      talon/scripting/dispatch.py:124| 
   10:          talon/scripting/rctx.py:200| 
    9: talon/scripting/speech_system.py:42 | 
    8:      talon/scripting/dispatch.py:98 | 
    7:      talon/scripting/dispatch.py:133| 
    6:      talon/scripting/dispatch.py:124| 
    5:          talon/scripting/rctx.py:200| 
    4: talon/scripting/speech_system.py:298| 
    3: talon/scripting/speech_system.py:336| 
    2:         talon/grammar/grammar.py:58 | 
    1:              talon/grammar/vm.py:308| 
2020-10-01 23:10:39 WARNING [watchdog] "talon.vad.<lambda>" @4.0s
   24:       lib/python3.7/threading.py:890| 
   23:       lib/python3.7/threading.py:926| 
   22:       lib/python3.7/threading.py:870| 
   21:                    talon/cron.py:112| 
   20: ------------------------------------# cron thread
   19:                    talon/cron.py:77 | 
   18:          talon/scripting/rctx.py:200| 
   17: ------------------------------------# 'cron' main:call()
   16:                     talon/vad.py:16 | 
   15:             talon/engines/w2l.py:745| 
   14:      talon/scripting/dispatch.py:98 | 
   13:      talon/scripting/dispatch.py:133| 
   12:      talon/scripting/dispatch.py:124| 
   11:          talon/scripting/rctx.py:200| 
   10: talon/scripting/speech_system.py:42 | 
    9:      talon/scripting/dispatch.py:98 | 
    8:      talon/scripting/dispatch.py:133| 
    7:      talon/scripting/dispatch.py:124| 
    6:          talon/scripting/rctx.py:200| 
    5: talon/scripting/speech_system.py:298| 
    4: talon/scripting/speech_system.py:336| 
    3:         talon/grammar/grammar.py:58 | 
    2:              talon/grammar/vm.py:314| 
    1:              talon/grammar/vm.py:482| 
2020-10-01 23:10:40 WARNING [watchdog] "talon.scripting.speech_system._redispatch" @4.1s
   25:       lib/python3.7/threading.py:890| 
   24:       lib/python3.7/threading.py:926| 
   23:       lib/python3.7/threading.py:870| 
   22:                    talon/cron.py:112| 
   21: ------------------------------------# cron thread
   20:                    talon/cron.py:77 | 
   19:          talon/scripting/rctx.py:200| 
   18: ------------------------------------# 'cron' user.engines:call()
   17:                     talon/vad.py:16 | 
   16:             talon/engines/w2l.py:745| 
   15:      talon/scripting/dispatch.py:98 | 
   14:      talon/scripting/dispatch.py:133| 
   13:      talon/scripting/dispatch.py:124| 
   12:          talon/scripting/rctx.py:200| 
   11: talon/scripting/speech_system.py:42 | 
   10:      talon/scripting/dispatch.py:98 | 
    9:      talon/scripting/dispatch.py:133| 
    8:      talon/scripting/dispatch.py:124| 
    7:          talon/scripting/rctx.py:200| 
    6: talon/scripting/speech_system.py:298| 
    5: talon/scripting/speech_system.py:336| 
    4:         talon/grammar/grammar.py:58 | 
    3:              talon/grammar/vm.py:314| 
    2:              talon/grammar/vm.py:487| 
    1:              talon/grammar/vm.py:210| 
2020-10-01 23:10:40 WARNING [watchdog] "talon.scripting.speech_system.engine_event" @4.3s
   24:       lib/python3.7/threading.py:890| 
   23:       lib/python3.7/threading.py:926| 
   22:       lib/python3.7/threading.py:870| 
   21:                    talon/cron.py:112| 
   20: ------------------------------------# cron thread
   19:                    talon/cron.py:77 | 
   18:          talon/scripting/rctx.py:200| 
   17: ------------------------------------# 'cron' user.engines:call()
   16:                     talon/vad.py:16 | 
   15:             talon/engines/w2l.py:745| 
   14:      talon/scripting/dispatch.py:98 | 
   13:      talon/scripting/dispatch.py:133| 
   12:      talon/scripting/dispatch.py:124| 
   11:          talon/scripting/rctx.py:200| 
   10: talon/scripting/speech_system.py:42 | 
    9:      talon/scripting/dispatch.py:98 | 
    8:      talon/scripting/dispatch.py:133| 
    7:      talon/scripting/dispatch.py:124| 
    6:          talon/scripting/rctx.py:200| 
    5: talon/scripting/speech_system.py:298| 
    4: talon/scripting/speech_system.py:336| 
    3:         talon/grammar/grammar.py:58 | 
    2:              talon/grammar/vm.py:314| 
    1:              talon/grammar/vm.py:500| 
2020-10-01 23:10:40 WARNING [watchdog] "grammar(talon_main).parse()" @4.3s
   28:       lib/python3.7/threading.py:890| 
   27:       lib/python3.7/threading.py:926| 
   26:       lib/python3.7/threading.py:870| 
   25:                    talon/cron.py:112| 
   24: ------------------------------------# cron thread
   23:                    talon/cron.py:77 | 
   22:          talon/scripting/rctx.py:200| 
   21: ------------------------------------# 'cron' user.engines:call()
   20:                     talon/vad.py:16 | 
   19:             talon/engines/w2l.py:745| 
   18:      talon/scripting/dispatch.py:98 | 
   17:      talon/scripting/dispatch.py:133| 
   16:      talon/scripting/dispatch.py:124| 
   15:          talon/scripting/rctx.py:200| 
   14: talon/scripting/speech_system.py:42 | 
   13:      talon/scripting/dispatch.py:98 | 
   12:      talon/scripting/dispatch.py:133| 
   11:      talon/scripting/dispatch.py:124| 
   10:          talon/scripting/rctx.py:200| 
    9: talon/scripting/speech_system.py:298| 
    8: talon/scripting/speech_system.py:336| 
    7:         talon/grammar/grammar.py:58 | 
    6:              talon/grammar/vm.py:314| 
    5:              talon/grammar/vm.py:405| 
    4:             talon/grammar/dfa.py:106| 
    3:             talon/grammar/dfa.py:118| 
    2:             talon/grammar/dfa.py:226| 
    1:             talon/grammar/dfa.py:216| 
2020-10-01 23:10:41    IO [audio]=2190.000ms  [emit]=33.853ms (0.02x)  [decode]=8.160ms (0.00x)  [total]=42.014ms (0.02x)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lunixbochscommented, Nov 2, 2020

words (and words)* then

0reactions
lunixbochscommented, Nov 9, 2020

You should copy the tests from numbers.py

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# developers! Are you tired of slow string parsing code?
This code sets up a list of 1000 strings. Each string contains a random sequence of 5 digits from one to nine. The...
Read more >
Parsing is extremely slow · Issue #35 · orangeduck/mpc
to parse a file 10000 times. Running examples/doge.c with an empty input file needs 0.9sec on a 1Ghz x86. Therefore a single iteration...
Read more >
the official, authorized FAQ for Parse::RecDescent.
Eliminate backtracking when possible · Precompiling Grammars for Speed of Execution · Parse::RecDescent is slow on Really Big Files. How can I speed...
Read more >
Parser written in PHP is 5.6x faster than the same C++ ...
I ran a simple CSV parsing program in both that have the same output. The CSV file is 40,194,684 parsed down to 1,537,194...
Read more >
Refterm Lecture Part 5 - Parsing with SIMD - YouTube
https://www.kickstarter.com/projects/annarettberg/meow-the-infinite-book-twoLive Channel: https://www.twitch.tv/molly_rocketPart 1 : ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found