mChat + Google Translate script = high CPU load

Support area for phpBB's mChat extension
Post Reply
dimassamid
Donor
Posts: 11
Joined: 11 Jan 2019, 04:19

mChat + Google Translate script = high CPU load

#1

Post by dimassamid » 02 Oct 2019, 22:51

Hello!

I use the "Google Translate" script on my forum.

Code: Select all

<div id="google_translate_element" style="display:inline-block; float:right"></div>
<script>
	function googleTranslateElementInit() {
	new google.translate.TranslateElement({pageLanguage: 'ru', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, multilanguagePage: true}, 'google_translate_element');
	}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
You can use your own code directly from Google or install this extension:
https://www.phpbb.com/customise/db/exte ... ranslator/
It does not matter. In any case, when this script is installed, the mChat runs slowly and loads the CPU.

Usually, without a "Google Translate" script, mChat loads the CPU in scroll mode only. In standby mode CPU load is ~1%
If the google script is enabled, the CPU is always loaded (about 30-50%) even in standby mode, especially after scrolling through messages.

The conflict occurs only on pages where mChat is installed. On the other pages everything is fine. You can not use translation button. It’s enough that it’s just embedded in the overall_header.html
I tested this in a clean forum with no additional extensions. I received many complaints from my users that their computer is slow when they are chatting :(

Could you please check compatibility with "Google Translate" script? Thank you in advance! :beer:
Last edited by dimassamid on 02 Oct 2019, 23:24, edited 1 time in total.

terry2
Donor
Posts: 192
Joined: 22 Oct 2016, 18:22
Location: My castle

Re: mChat + Google Translate script = high CPU load

#2

Post by terry2 » 02 Oct 2019, 23:14

Why use a translator like that ? you dont need a script the browser alone can translate if you set it up right.

dimassamid
Donor
Posts: 11
Joined: 11 Jan 2019, 04:19

Re: mChat + Google Translate script = high CPU load

#3

Post by dimassamid » 02 Oct 2019, 23:28

Many use browsers without a translator. Users want to see this button, it’s easier for them. Some people are not tech savvy.

User avatar
kasimi
mChat developer
Posts: 985
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: mChat + Google Translate script = high CPU load

#4

Post by kasimi » 03 Oct 2019, 11:27

I can't reproduce this problem. The Google Translator extension works fine with mChat in Firefox. What browser are you using?

dimassamid
Donor
Posts: 11
Joined: 11 Jan 2019, 04:19

Re: mChat + Google Translate script = high CPU load

#5

Post by dimassamid » 03 Oct 2019, 15:20

kasimi wrote:
03 Oct 2019, 11:27
What browser are you using?
Google chrome

User avatar
kasimi
mChat developer
Posts: 985
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: mChat + Google Translate script = high CPU load

#6

Post by kasimi » 03 Oct 2019, 19:04

Is performance slowly degrading as users keep chatting and messages are added, or is it slow right from the start? I really can't think of a reason so please share anything you think might help find the problem.

Did you ask the author of the Google Translate extension if he had similar reports? Maybe it's not just mChat that's affected?

dimassamid
Donor
Posts: 11
Joined: 11 Jan 2019, 04:19

Re: mChat + Google Translate script = high CPU load

#7

Post by dimassamid » 04 Oct 2019, 19:39

I recorded short video with the problem
https://drive.google.com/open?id=1f1Y-L ... ksJJ5ciaTx
kasimi wrote:
03 Oct 2019, 19:04
Did you ask the author of the Google Translate extension if he had similar reports? Maybe it's not just mChat that's affected?
No, I did not write to him. I think this is a Google problem. I pasted the official button code to "overall_header.html" directly without the phpBB extension - the same problem.

User avatar
kasimi
mChat developer
Posts: 985
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: mChat + Google Translate script = high CPU load

#8

Post by kasimi » 04 Oct 2019, 19:50

Those are some crazy CPU load numbers indeed. I'm afraid I don't have the time to investigate, but if you have any ideas what I could try to fix this in mChat, do let me know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest