[tex4ht] what is the fastest way to convert large document to HTML?

Michal Hoftich michal.h21 at gmail.com
Mon Aug 20 00:03:37 CEST 2018


Hi Reinhard,

> Hi Michal,
> if you use -j without an argument make will try to do everything at
> the same time.  This leads to zillions of processes and open
> files. It's better to specify the number of available CPUs:
>

Ah, this explains why my computer freeze for 20 minutes when I tried
Nasser's huge file. I read on some page that the -j parameter sets the
number of parallel jobs to number of CPU cores - 1, but it seems that
it is not the case.

> ------------------------------------------------------------------
> #!/usr/bin/env texlua
>
> local cpu_cnt = 4  -- set a reasonable default for non-Linux systems
>
> if os.name == 'linux' then
>   cpu_cnt = 0
>   local cpuinfo=assert(io.open('/proc/cpuinfo', 'r'))
>   for line in cpuinfo:lines() do
>     if line:match('^processor') then
>       cpu_cnt = cpu_cnt + 1
>     end
>   end
>   cpuinfo:close()
> end
>
> -- print(cpu_cnt)
> ------------------------------------------------------------------
>
> And then
>
> -  local command = "make -j -f " .. makefilename
> +  local command = "make -j"..cpu_cnt.." -f " .. makefilename
>

Thanks, this is nice. I will create a make4ht extension from this
code, so it will be possible to use this functionality without need to
create make4ht build files.

Best regards,
Michal


More information about the tex4ht mailing list