gusl: (Default)
[personal profile] gusl
Today I implemented caching for the NGramDatabase class, and made lots of little improvements to my code.

I'm pleased about having written code that flattens the HashMap object into a file (the secret is to use an ObjectOutputStream).

The results of caching were encouraging. For ~30000 queries (40 * 6 * 128), using a complete cache of 849kb, my program runs in 17 seconds instead of 40 minutes.

Lesson of the day: when using HashMap< K, V >, make sure K is a literal (String is close enough). It would have been more natural to use string arrays, but the problem is that each time that you query, the array will be a different object. As a result, the HashMap (i.e. 'cache') will keep growing, and will never get used.

To Do:
* enable queries with wildcards: will first need to refactor Andy's code, before modifying the SQL query.
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags