Faster Language File Updates

By Edouard on November 4, 2022

We’ve released an update to the code that generates your language files. We’ve measured that it is now about 16,5 times faster, especially for very large language files (files containing more than 10,000 segments).

Here’s an example with the largest language file hosted on WebTranslateIt, a PO file containing almost 20,000 segments:

Before, it used to take a bit over 2 minutes to update that file on a low server load:

irb(main):001:0> file = ProjectFile.find 123456
=> 
#<ProjectFile:0x00007f30bdc99858                                            
irb(main):002:0> def time(&block) puts Benchmark.measure(&block) end
=> :time
irb(main):003:0> time { file.initialize_file }
112.233529  10.585214 122.818743 (124.697003)                                  

It now takes about 7 seconds to update that file:

irb(main):001:0> file = ProjectFile.find 123456
=> 
#<ProjectFile:0x00007f146ff38588
irb(main):002:0> def time(&block) puts Benchmark.measure(&block) end
=> :time
irb(main):003:0> time { file.initialize_file }
  6.442130   0.219835   6.661965 (  7.475081)                           

These improvements will allow to have your language files ready faster.