roadlabs / cefpython

Automatically exported from code.google.com/p/cefpython
0 stars 0 forks source link

Build CEF without tcmalloc global hook on Linux #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that on Linux the tcmalloc implementation is hooked globally
when importing the CEF library, this might cause troubles when CEF is not 
the very first library being loaded in the application. See this topic
for more details:

http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10850

Original issue reported on code.google.com by czarek.t...@gmail.com on 16 Jul 2013 at 8:23

GoogleCodeExporter commented 9 years ago
The instructions on the BuildOnLinux page should be updated.

Original comment by czarek.t...@gmail.com on 16 Jul 2013 at 8:24

GoogleCodeExporter commented 9 years ago
To disable tcmalloc:

 Add linux_use_tcmalloc=0 in your ~/.gyp/include.gypi file. 

See API Keys how-to for a general example of the technique:

 http://www.chromium.org/developers/how-tos/api-keys

Original comment by czarek.t...@gmail.com on 16 Jul 2013 at 9:05

GoogleCodeExporter commented 9 years ago
How is disabling tcmalloc going to affect the performance? Make tests.

Original comment by czarek.t...@gmail.com on 16 Jul 2013 at 9:06

GoogleCodeExporter commented 9 years ago
To get this to work place this in your ~/.gyp/include.gypi:

{
  'variables': {
    'linux_use_tcmalloc':0,
  },
}

Also you need to remove a dependencie in cef.py to make it build. Find:

[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
  'dependencies':[

Remove the line:
<(DEPTH)/base/allocator/allocator.gyp:allocator',

This could be better to add a conditional in this file, as suggested here.

http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10496

Original comment by blake.ro...@vindeka.com on 31 Oct 2013 at 8:00

GoogleCodeExporter commented 9 years ago
If you do not import cefpython as the very first module, you may be getting 
random unrelated segmentation faults all over your app. Adding or removing some 
code might fix the crash, as it changes memory layout, but the crashes will be 
returning.

Original comment by czarek.t...@gmail.com on 8 Jan 2014 at 9:14

GoogleCodeExporter commented 9 years ago
Has anyone tested Blake's solution? Has anyone done performance tests? 

I think that tcmalloc hook should be disabled by default. I'm only worried 
about performance. Requiring cefpython to be the very first import in app makes 
CEF look bad from the technical side.

Original comment by czarek.t...@gmail.com on 8 Jan 2014 at 9:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I've made some tests for tcmalloc enabled/disabled. In javascript test 1 which 
tests creation of cef v8 types (int, bool, string), tcmalloc is faster by about 
30-40%. In javascript test 2 which tests speed of function execution with 
different types returned, tcmalloc doesn't make much difference, sometimes it 
is a bit faster sometimes a bit slower.

See comparison table of javascript test 1:
https://docs.google.com/document/d/1ykllgRgA0FqXKMQ-O3LkqcRjVOYVRY63dWLvAhWw4a8/
edit?pli=1

Javascript tests 1 and 2 for tcmalloc enabled:
https://docs.google.com/document/d/1SuEN8Mi1hpPuFtDJ6FxOBYOor3Euao__kY1raMNvnpY/
edit?pli=1

Javascript tests 1 and 2 for tcmalloc disabled:
https://docs.google.com/document/d/1R033Nip4-O_yMvE_oLJutrWj6qrdmpb5HoozDVOqCAE/
edit

Original comment by czarek.t...@gmail.com on 9 Feb 2014 at 10:05

GoogleCodeExporter commented 9 years ago
It looks better when running real browser test at peacekeeper.futuremark.com. 
The version with tcmalloc disabled is faster by 2.3% (4804 tcmalloc disabled vs 
4695 tcmalloc enabled).

See full details:
https://docs.google.com/document/d/1_X2F9Ax6opGYGVDP_N6UC8AKA37eG8h8Jf3bwFj7RS4/
edit?usp=sharing

Original comment by czarek.t...@gmail.com on 9 Feb 2014 at 10:39

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 9 Apr 2014 at 6:45

GoogleCodeExporter commented 9 years ago
The CEF javascript tests 1 and 2 are not really about js performance, thus 
should be ignored. See this post for an explanation: 
http://www.magpcss.org/ceforum/viewtopic.php?p=20129#p20129

Original comment by czarek.t...@gmail.com on 8 Jun 2014 at 12:41

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'd like to add that the file where one should remove the 
"<(DEPTH)/base/allocator/allocator.gyp:allocator'," line is not "cef.py", but 
"cef.gyp" instead, located in the root directory where cef sources are 
(./chromium/src/cef/cef.gyp).

This should be fixed in the BuildOnLinux wiki page.

Regards

Original comment by fernandezm on 17 Jul 2014 at 2:03

GoogleCodeExporter commented 9 years ago
@comment #15 fernandezm
Thanks, fixed.

Original comment by czarek.t...@gmail.com on 17 Jul 2014 at 7:44

GoogleCodeExporter commented 9 years ago
The new cefpython 31.0 binary release will have tcmalloc disabled.

Original comment by czarek.t...@gmail.com on 31 Jul 2014 at 4:15