CEF framework and JS communication performance doubts

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

CEF framework and JS communication performance doubts

Postby SuR » Thu Dec 01, 2022 5:34 am

A recent project used the CEF framework, and the JS code needed to send a lot of instructions to CEF and back some param.
I know, a normal kind of correspondence:
void Renderer::OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
{
CefRefPtr<CefV8Value> globalObject = context->GetGlobal();
v8Handler = new V8Handler();
//IMPLEMENT_REFCOUNTING(V8Handler);
CefRefPtr<CefV8Value> nativeCall = CefV8Value::CreateFunction("nativeCall", v8Handler);
globalObject->SetValue("nativeCall", nativeCall, V8_PROPERTY_ATTRIBUTE_READONLY);
}
Register the nativeCall global function for JS.
However, I worry that it will get stuck when you request a lot of data at once, hundreds of requests and do json parsing.
Therefore, I also thought of embedding nodejs environment into CEF and making C++ access shared memory plug-in through node-pyq to become a data channel between js and CEF, but I did not know whether this method is feasible and how difficult it is to practice.
Or there are other ways, and hopefully someone can answer that. Thank you very much.
SuR
Newbie
 
Posts: 5
Joined: Thu Dec 01, 2022 4:20 am

Re: CEF framework and JS communication performance doubts

Postby SuR » Thu Dec 08, 2022 1:53 am

Now using 20 timers to test, data transmission is not slow, but CPU consumption, is the problem of the timer? Using C++ publish-subscribe model instead?
SuR
Newbie
 
Posts: 5
Joined: Thu Dec 01, 2022 4:20 am

Re: CEF framework and JS communication performance doubts

Postby SuR » Thu Dec 08, 2022 4:30 am

Or the mechanism of CEF communicating with JS and publishing and subscribing, as in the message_router case, but I'm not sure
message_router : https://bitbucket.org/chromiumembedded/ ... ge_router/
SuR
Newbie
 
Posts: 5
Joined: Thu Dec 01, 2022 4:20 am

Re: CEF framework and JS communication performance doubts

Postby magreenblatt » Mon Dec 12, 2022 4:53 pm

I worry that it will get stuck when you request a lot of data at once, hundreds of requests and do json parsing.

It depends on what you mean by "a lot of data" and where (what process/thread) you're performing the json parsing.
magreenblatt
Site Admin
 
Posts: 12379
Joined: Fri May 29, 2009 6:57 pm

Re: CEF framework and JS communication performance doubts

Postby SuR » Sun Dec 18, 2022 8:26 pm

Thank you. Is the data processing better in the browser? Is it easy to get stuck processing data in Render? "A lot of data" means that the Execute API of the V8Handler is called more frequently.
SuR
Newbie
 
Posts: 5
Joined: Thu Dec 01, 2022 4:20 am

Re: CEF framework and JS communication performance doubts

Postby magreenblatt » Sun Dec 18, 2022 9:15 pm

JS executes on a single thread in the renderer. That could potentially be a bottleneck.
magreenblatt
Site Admin
 
Posts: 12379
Joined: Fri May 29, 2009 6:57 pm


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 3 guests