Performance drops in node editor when rendering multiple special characters in socket names. #105891

Closed
opened 2023-03-18 23:40:28 +01:00 by zorro-weaver · 2 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.24

Blender Version
Broken: version: 3.4.0, branch: blender-v3.4-release, commit date: 2022-12-06 18:46, hash: rBa95bf1ac01be
Worked: (newest version of Blender that worked as expected)

Short description of error
I'd like to use special unicode icons to add some pizazz and visibility to my important nodegroup sockets. However, doing so has a massive performance hit in the node editor. It seems to only affec zooming, and only happens when you have more than one type of icon. The bug is present in all node editors.

Exact steps for others to reproduce the error

  1. Open any node editor and create a nodegroup.
  2. Inside the nodegroup, add a socket and rename it, adding an emoji or special unicode character.
  3. Repeat step 2, using a different character.
  4. Exit the nodegroup.
  5. Attempt to zoom in or out. It will be drastically slower than usual. Other actions such as panning, moving nodes and adding nodes are not affected.
**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.24 **Blender Version** Broken: version: 3.4.0, branch: blender-v3.4-release, commit date: 2022-12-06 18:46, hash: `rBa95bf1ac01be` Worked: (newest version of Blender that worked as expected) **Short description of error** I'd like to use special unicode icons to add some pizazz and visibility to my important nodegroup sockets. However, doing so has a massive performance hit in the node editor. It seems to only affec zooming, and only happens when you have more than one type of icon. The bug is present in all node editors. **Exact steps for others to reproduce the error** 1. Open any node editor and create a nodegroup. 1. Inside the nodegroup, add a socket and rename it, adding an emoji or special unicode character. 1. Repeat step 2, using a different character. 1. Exit the nodegroup. 1. Attempt to zoom in or out. It will be drastically slower than usual. Other actions such as panning, moving nodes and adding nodes are not affected.
751 KiB
zorro-weaver added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-03-18 23:40:29 +01:00
Harley Acheson self-assigned this 2023-03-19 00:15:03 +01:00
Member

I can confirm.

I can confirm.
Member

@zorro-weaver

Thanks for this report. I think I can improve this performance a bit.

First a bit of a backgrounder.

You are now able to select from those emojis and lots of other new characters because we are no longer using a single font, but a "stack" of fonts. So when a character is not found in the main font we look in a list of alternative fonts. This is done in conjunction with a new caching scheme that also only loads fonts when they are needed, and can unload them when no longer needed.

In your example case you are using character "🙂" U+1F642 in the Unicode block "Emoticons" (U+1F600 - U+1F64F) in the Supplementary Multilingual Plane (U+10000 - U+1FFFF), and "🍔" U+1F354 in the block "Miscellaneous Symbols and Pictographs" (U+1F300 - U+1F5FF) also in the
Supplementary Multilingual Plane.

The reason you get a slowdown while zooming but not in regular usage is because we cache the rendered glyphs once we find them. So although we have to go through some work to look through other fonts to locate these characters we don't have to do this often.

However, when zooming we are (necessarily) having to re-render everything at a new size, which means we do have to look through our fonts to find them.

My first concern with this was that this lookup was causing us to go over our allocated maximum number of simultaneously loaded fonts. This wouldn't be a big problem, as the font cache is very good at temporarily unloading fonts, loading new ones, etc. But it would just be a bit slower than if it didn't have to do so. But this isn't the case here as during zooming there are no fonts unloaded or loaded.

The lookup of the glyphs does show a couple ways to improve though.

At this point of the code we are using our regular UI font, DejaVuSans.woff2, and needing some glyphs it does not have (Slightly Smiling Face and Hamburger). It goes through our fallback font stack but does not touch files that are unrelated to this Unicode range.

However it does load and test against our monospaced font, DejaVuSansMono.woff2. This font has "coverage bits" set that indicate that is has some glyphs in this range. However I can't see any reason to look in a monospaced font for a proportional use. The reverse would be fine though. I'll look into stopping this and possibly correcting its coverage bits.

It also tests against our large "Noto Sans CJK Regular.woff2" font, which is used for Chinese, Japanese, and Korean. That font also includes the coverage bits for these glyph ranges. I'll look into changing the coverage bits because I would rather we get these ranges from our specific fonts (Noto Emoji, Symbols, Symbols2).

This should have us hit those characters faster.

@zorro-weaver Thanks for this report. I *think* I can improve this performance a bit. First a bit of a backgrounder. You are now able to select from those emojis and lots of other new characters because we are no longer using a single font, but a "stack" of fonts. So when a character is not found in the main font we look in a list of alternative fonts. This is done in conjunction with a new caching scheme that also only loads fonts when they are needed, and can unload them when no longer needed. In your example case you are using character "🙂" U+1F642 in the Unicode block "Emoticons" (U+1F600 - U+1F64F) in the Supplementary Multilingual Plane (U+10000 - U+1FFFF), and "🍔" U+1F354 in the block "Miscellaneous Symbols and Pictographs" (U+1F300 - U+1F5FF) also in the Supplementary Multilingual Plane. The reason you get a slowdown while zooming but not in regular usage is because we cache the rendered glyphs once we find them. So although we have to go through some work to look through other fonts to locate these characters we don't have to do this often. However, when zooming we are (necessarily) having to re-render everything at a new size, which means we do have to look through our fonts to find them. My first concern with this was that this lookup was causing us to go over our allocated maximum number of simultaneously loaded fonts. This wouldn't be a big problem, as the font cache is very good at temporarily unloading fonts, loading new ones, etc. But it would just be a bit slower than if it didn't have to do so. But this isn't the case here as during zooming there are no fonts unloaded or loaded. The lookup of the glyphs does show a couple ways to improve though. At this point of the code we are using our regular UI font, DejaVuSans.woff2, and needing some glyphs it does not have (Slightly Smiling Face and Hamburger). It goes through our fallback font stack but does not touch files that are unrelated to this Unicode range. However it does load and test against our monospaced font, DejaVuSansMono.woff2. This font has "coverage bits" set that indicate that is has some glyphs in this range. However I can't see any reason to look in a monospaced font for a proportional use. The reverse would be fine though. I'll look into stopping this and possibly correcting its coverage bits. It also tests against our large "Noto Sans CJK Regular.woff2" font, which is used for Chinese, Japanese, and Korean. That font also includes the coverage bits for these glyph ranges. I'll look into changing the coverage bits because I would rather we get these ranges from our specific fonts (Noto Emoji, Symbols, Symbols2). This should have us hit those characters faster.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-03-24 19:55:40 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105891
No description provided.