Page MenuHome

2.72 Freestyle renders two times longer on Linux
Closed, ResolvedPublic


System Information
Debian 7.5
GPU: Nvidia GeForce 9800 GT
CPU: Intel Core 2 3GHz

Blender Version
Broken: Linux versions: 2.72 eb464ee (blender-2.72-RC1-linux-glibc211-x86_64) and previous testbuild (blender-2.72-testbuild1-linux-glibc211-x86_64)
Worked: 2.6; 2.7; 2.71, 2.72 windows 64 version

Short description of error
The problem is too long Freestyle Stroke rendering. Simple file with Ve: 19k, Fa: 22k is rendering about 14 seconds. It is long, but linux version 2.72 testbuild and RC1 doing the same two times longer, need about 27-30 seconds.

Exact steps for others to reproduce the error
Open file

and render in Linux and Windows versions.

Event Timeline

Piotr Połomski (PiotrPL) raised the priority of this task from to 90.
Piotr Połomski (PiotrPL) updated the task description. (Show Details)
Piotr Połomski (PiotrPL) edited a custom field.
Tamito Kajiyama (kjym3) lowered the priority of this task from 90 to Normal.Sep 28 2014, 4:25 AM

Thanks Bastien. :)

Hello, I tested yesterday released 2.72 95182d1 (blender-2.72-linux-glibc211-x86_64.tar.bz2) and Freestyle Stroke rendering still takes two times longer than 2.71

I thought the report concerns a difference of rendering speeds between Linux and Windows. Do you mean that you have observed different rendering speeds between 2.71 and 2.72 both on Linux?

Rendering about 14sec on versions:

  • Linux 2.66.5 r55841
  • Linux 2.70a f93bc76
  • Linux 2.71 a19c1be
  • Windows 64 2.72 eb464ee

Rendering two times longer on versions:

  • Linux testbuild1 2.72
  • Linux RC1 2.72 eb464ee
  • Linux 2.72 95182d1

The same file, with the same rendering parameters.

Any news here? Getting quite old now.

Not much news from my side. I personally don't have a Linux box that can reproduce the reported speed problem. A friend of mine who uses Blender/Freestyle under Linux told me that he did not observe the issue.

@Piotr Połomski (PiotrPL),
I suppose that you render the .blend file from within the Blender user interface. What happens if you render the file by one of the following ways?

  • render the file with the Display option set to Keep UI (instead of New Window, Image Editor, or Full Screen) and without the Image Editor not shown in the UI.
  • render the file by means of the command-line interface.

This test will help us check if the slowness comes from Freestyle.

I am under ubuntu 14.04 64bits.
The blend gives me these results :

2.71 : 10s 20
2.72b : 21s
2.72.3 hash 602250d : 12s

Here are my stats compared to Ubuntu and windows

here is my specs

intel hd graphics 4600
blender 2.72b

Could you guys test with all Add-Ons disabled? We had similar issues caused by Add-Ons.

Tested with Ubuntu and took twice as long with add-ons disabled about 1min 20 sec

I cannot test on my workstation but on my laptop without addons.
2.71 20s
2.72b 52s
2.73fa0a 47s

Thanks, seems like Add-ons aren't the problem

Thank you all for the additional tests, very much appreciated!

If a few more test runs are acceptable, could you guys please do test renders with the --debug-freestyle command-line option specified when you start Blender? This will generate a lot of debug information on the console including the breakdown of Freestyle rendering time, which might allow us to identify the cause(s) of slow rendering on Linux. Please, consider saving the console output in a text file (e.g., by redirecting the standard output of Blender to a file as in ./blender --debug-freestyle > output.txt) and attaching the file to a reply. Thanks in advance.

@ronan ducluzeau (zeauro) Many thanks for the test results. Your logs allowed me to break down Freestyle time components. According to the analysis of timing information, there are no big differences in the Freestyle time components among Blender versions (see the comparisons in the attached PDF file). It looks like the slowness comes from somewhere outside the Freestyle rendering core.

Now I guess I have to look into the Blender rendering pipeline to identify the cause of the slowness...

@Tamito Kajiyama (kjym3), the issue is barely visible with regular builds and totally visible when using jemalloc (probably because of different memory layout in that case or so).

The issue is introduced by rB0464876 which in fact unleashes really evil aspect of freestyle. The thing here is, datablock data free would check if the datablock is used as a target of some driver (if it was used then driver's target ID would be set to NULL). Before the mentioned commit freestyle did not sent proper main to datablock free function, so iteration happened inside the wrong list. Now iteration happens with the proper list.

The cause of slowdown is the freestyle main free. It seems to contain around 13K datablocks, and assuming datablock deletion is O(n^2) that's gonna to take quite some time.

Hereby i'm raising some questions:

@Sergey Sharybin (sergey) It is necessary to iterate through each driver when freeing it, because we need to free the DriverVariable instances (on the ChannelDriver), then the ChannelDriver (on the FCurve).

@Sergey Sharybin (sergey),

The issue of too many data blocks (mostly meshes) was one of problems I have addressed as part of my BF project (Apr-Sept 2014) for Freestyle performance optimization. A quick test on my side showed that when the performance optimization was applied, only one mesh data block was created for rendering the test scene rather than 13K data blocks. The actual number of auto-generated data blocks can still be arbitrarily large depending on input scenes, but is expected to be much smaller than non-optimized versions. Integrating the optimization coding results into Git master is a 2.74 target.

Freestyle does not use drivers at all.

@Joshua Leung (aligorith), i'm having hard time to understand why we need to do drivers on datablock free but don't need to do constraint/modifiers/parents etc at the same time actually.

@Tamito Kajiyama (kjym3), that sounds good.

For those who compile Blender from source, here is a patch for the aforementioned Freestyle rendering optimization (rebased onto Git master, with a lot of conflicts addressed). The patch should apply cleanly to the latest HEAD as of this writing.

Maybe it is too late to include this revision to the 2.73 release.

@Tamito Kajiyama (kjym3), we can not accept this for 2.73, but master branch is open now so you can commit it for 2.74 when it's ready.

hello, I think I found solution, need to go to Freestyle Line Style, then in Strokes tab, check Chaining checkbox (and select Plain, check Same Object). Now nut.blend file renders for about 2 seconds! I hope it helps

@Tamito Kajiyama (kjym3), maybe you could create some testbuilds using the experimental-build branch (instructions here)? The folks here could test this then before committing.

I think I will just commit the proposed patch to git master after I test it a bit more. Then nightly builds will soon allow testers to check if the reported slowness has been addressed.

I will test tomorrow unless you know what hash it has been placed into

The patch

has been committed in Git master: rBd8b00a3bf5c1. Further performance tests would be much appreciated.

This did not work for me rendered on CPU with Ubuntu 14.04

Used blender Linux 64 bit Official blender-2.73- 8a28895 -linux-glibc211-x86_64.tar.bz2 94M Sat Jan 3 03:12:20 2015

Render time 3:15.95

Windows 8.0

I used blender version: Windows 64 bit Official blender-2.73- 8a28895 100M Sat Jan 3 03:13:48 2015

Render time: 56.49

Windows 8.0 Hardware specs

Intel(R) HD Graphics 4600

Report Date:			1/2/2015
Report Time[hh:mm:ss]:		12:37:25
Driver Version:
Operating System:		Windows 8  (6.2.9200)
Default Language:		English (United States)
Installed DirectX* Version:	11.1
Supported DirectX* Version:	11.1
Shader Version:			5.0
OpenGL* Version:			4.0
Physical Memory:		16136 MB
Processor:			Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
Processor Speed:		2394 MHz
Vendor ID:			8086
Device ID:			0416
Device Revision:		06

Ubuntu same specs but 7.5 GB of RAM (Virtual Machine)

Five and a half times slower!!!

@Aaron Carlisle (Blendify) you cant expect a virtual machine to render as fast as a real machine... it only uses a part of the available hardware...

@Julian Eisel (Severin) even though it is a virtual machine it still is dramatically different from the first time I tested under the same testing environment.

First test from earlier comments

Please never, ever use a virtual machine for bug reports in general, and performance tests in particular. The use of a single instruction somewhere can make the whole code orders of magnitude slower than on 'native' OS - or not. In other words, performances test results from a VM are absolutely meaningless.

Thanks for the feed back I would like to some day set up a split hard drive

Using a VM to do performance test, the result depends on much more factors than on a real installation. Even if you think everything is the same it may not be so. So just as Bastien said, performance tests on a VM are meaningless :/

Hello, would You like to test render time of the same file (now Strokes Chaining is checked)

Now render time is about 2-3 seconds on my Debian Nvidia GeForce 9800 GT & Intel Core 2 3GHz

What's the latest status here? Could somebody test again so we can see if the issue has been resolved?

The issue has been resolved.

On my workstation, the original file of bugreport takes 20 seconds with 2.73a but only 1 s with current master 0f65250.

With nut-stroke.blend, results are 1.12 s with 2.73a and 0.85 s with current master 0f65250.

Julian Eisel (Severin) changed the task status from Unknown Status to Resolved.Feb 19 2015, 3:44 PM

That's good news! Closing as Resolved then :)