Cleanup: Use StringRef instead of std::string for node declaration #107911

Closed
Iliya Katushenock wants to merge 2 commits from mod_moder:tmp_use_string_ref_in_socket_declarations into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

This strings going not changed at runtime. So, better
to use StringRef instead of std::string for avoid
overhead on memory allocation in constructor.
It also will be make muth more sense in dynamic
declarations in future.

This strings going not changed at runtime. So, better to use `StringRef` instead of `std::string` for avoid overhead on memory allocation in constructor. It also will be make muth more sense in dynamic declarations in future.
Iliya Katushenock added the
Interest
Geometry Nodes
label 2023-05-13 19:51:03 +02:00
Iliya Katushenock added 1 commit 2023-05-13 19:51:12 +02:00
Iliya Katushenock requested review from Hans Goudey 2023-05-13 19:51:17 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-05-13 19:51:20 +02:00
Member

This is probably only worth it if it gives a noticeable performance improvement, since it means we have to think about lifetimes where we wouldn't have to otherwise. It may be theoretically better but that doesn't necessarily mean it's worth our time!

This is probably only worth it if it gives a noticeable performance improvement, since it means we have to think about lifetimes where we wouldn't have to otherwise. It may be theoretically better but that doesn't necessarily mean it's worth our time!
Author
Member

For code cleanliness, to be clear in the future, it's better to avoid overhead in declarations that can be called for every update of every node...

For code cleanliness, to be clear in the future, it's better to avoid overhead in declarations that can be called for every update of every node...
Member

I think just using a const char * when refering to static strings is fine too. Alternatively could use a static std::string but I don't have a strong preference right now. StringRef would be fine with me as well I guess.

I think just using a `const char *` when refering to static strings is fine too. Alternatively could use a `static std::string ` but I don't have a strong preference right now. `StringRef` would be fine with me as well I guess.
Author
Member

It seems that using a static std::string may still not be cheap (somewhere and sometime we need to allocate this). In fact, here we just want to pass a pointer to a static string. And we can just do it (but not a raw pointer, but what string type argument the socket constructor takes (StringRef)).

It seems that using a static `std::string` may still not be cheap (somewhere and sometime we need to allocate this). In fact, here we just want to pass a pointer to a static string. And we can just do it (but not a raw pointer, but what string type argument the socket constructor takes (`StringRef`)).
Iliya Katushenock added 1 commit 2023-07-11 20:36:32 +02:00
Author
Member
https://projects.blender.org/blender/blender/pulls/113553
Iliya Katushenock deleted branch tmp_use_string_ref_in_socket_declarations 2023-10-11 17:36:20 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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 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#107911
No description provided.