Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display performance decreased with BlGaussianShadowEffect on BlElement #259

Closed
LouisePla opened this issue May 23, 2023 · 3 comments
Closed

Comments

@LouisePla
Copy link

When a BlGaussianShadowEffect is added on a BlElement, the display performance of the application decrease.

Example:

       | space |
	space := OBlSpace new.
	space root layout: (BlFlowLayout horizontal).
	
	1 to: 200 do:[ :i | | e1 e2 e3 e4 e5 |
		e1 := BlElement new.
		e1 size: 100 asPoint.
		e1  background: (Color random).
                "Uncomment the effect below to see display performance decreased"
		"e1 effect:  (BlGaussianShadowEffect
		  	color: ((Color fromHexString: '010532') alpha: 0.08)
		  	width: 2
		  	offset: 0 @ 2)."
		space root addChild: e1.
	].
	
	space show
@plantec
Copy link
Collaborator

plantec commented May 23, 2023

well, afaik gaussian effect is not natively computed by Cairo but with a dedicated algorithm in Alexandrie...
so I would not use it for such number of elements in the same parent

@tinchodias
Copy link
Collaborator

tinchodias commented Aug 3, 2023

This may have improved now that elements with shadows that don't change keep cached,

To add some numbers:

block := [ :isShadowEnabled |
   | space |
	space := BlSpace new.
	space root layout: (BlFlowLayout horizontal).
	
	1 to: 200 do: [ :i |
		| e1 |
		e1 := BlElement new.
		e1 size: 100 asPoint.
		e1 background: Color random.
		
		isShadowEnabled ifTrue: [
			e1 effect: (BlGaussianShadowEffect
			  	color: Color red
			  	width: 2
			  	offset: 0 @ 2) ].

		space root addChild: e1 ].
	
	space root asForm ].

{ false. true } collect: [ :each |
	[ block value: each ] timeToRun asMilliSeconds ]

"---> #(32   1034)"


{ false. true } collect: [ :each |
	[ block value: each ] bench ]

"---> #('35.025 per second' '0.955 per second')"

@tinchodias
Copy link
Collaborator

Let's keep the topic in #669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants