BLI: add chunked list data structure that uses linear allocator #118774

Merged
Jacques Lucke merged 12 commits from JacquesLucke/blender:linear-allocator-unordered-list into main 2024-02-28 22:22:30 +01:00
Member

This adds a new special purpose container data structure that can be used to gather many elements into many (potentially small) lists efficiently.

I originally worked on this data structure because I might want to use it in #118772. However, also it's useful in the geometry nodes logger already. I'm measuring a 10-20% speed improvement in my many-math-nodes file when I enable logging for all sockets (not just the ones that are currently visible).

This adds a new special purpose container data structure that can be used to gather many elements into many (potentially small) lists efficiently. I originally worked on this data structure because I might want to use it in #118772. However, also it's useful in the geometry nodes logger already. I'm measuring a 10-20% speed improvement in my many-math-nodes file when I enable logging for all sockets (not just the ones that are currently visible).
Jacques Lucke added 7 commits 2024-02-27 01:18:55 +01:00
Hans Goudey reviewed 2024-02-27 03:52:19 +01:00
Hans Goudey left a comment
Member

Comparing this VectorList, and your old ChunkList container, I guess this makes more sense for a small number of elements? i.e. the goal is to avoid wasting memory than avoiding reallocations?

Comparing this `VectorList`, and your old `ChunkList` [container](https://projects.blender.org/JacquesLucke/blender/compare/main...temp-chunk-list), I guess this makes more sense for a small number of elements? i.e. the goal is to avoid wasting memory than avoiding reallocations?
Author
Member

Yeah, and also to avoid many small allocations when having potentially very many of these vectors. With this new type, they can all share the same few global allocations.

Yeah, and also to avoid many small allocations when having potentially very many of these vectors. With this new type, they can all share the same few global allocations.
Iliya Katushenock reviewed 2024-02-27 14:46:14 +01:00
@ -0,0 +12,4 @@
namespace blender::linear_allocator {
template<typename T, int64_t Capacity> struct UnorderedListSegment {

Is there the chance to have structure with ~the same fields (next, size) but with runtime size of values (so kind of raw bits array with header and values)?
It is good to just have template, but sometime you just want to push span with known size in trivial way..

Is there the chance to have structure with ~the same fields (`next`, `size`) but with runtime size of values (so kind of raw bits array with header and values)? It is good to just have template, but sometime you just want to push span with known size in trivial way..
Author
Member

In theory we could have that, but this is a very special purpose data structure, and currently we need the ability you're requesting. Supporting it would cause additional overhead.

In theory we could have that, but this is a very special purpose data structure, and currently we need the ability you're requesting. Supporting it would cause additional overhead.
JacquesLucke marked this conversation as resolved
Jacques Lucke added 2 commits 2024-02-28 12:00:43 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
59e9685b27
add comments
Author
Member

@blender-bot build

@blender-bot build
Jacques Lucke requested review from Hans Goudey 2024-02-28 12:03:17 +01:00
Jacques Lucke changed title from WIP: BLI: add unordered list data structure that uses linear allocator to BLI: add unordered list data structure that uses linear allocator 2024-02-28 12:03:27 +01:00
Hans Goudey reviewed 2024-02-28 17:01:35 +01:00
Hans Goudey left a comment
Member

Looks good to me. Thanks for adding more to the comment. How about calling this ChunkedList? The "unordered" part doesn't seem as important as the fact that multiple items are stored together in small chunks.

Looks good to me. Thanks for adding more to the comment. How about calling this `ChunkedList`? The "unordered" part doesn't seem as important as the fact that multiple items are stored together in small chunks.
@ -0,0 +1,190 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
Member

2024

2024
JacquesLucke marked this conversation as resolved
Jacques Lucke added 3 commits 2024-02-28 22:16:50 +01:00
Hans Goudey approved these changes 2024-02-28 22:17:36 +01:00
Jacques Lucke changed title from BLI: add unordered list data structure that uses linear allocator to BLI: add chunked list data structure that uses linear allocator 2024-02-28 22:18:24 +01:00
Jacques Lucke merged commit fe2a47b5a7 into main 2024-02-28 22:22:30 +01:00
Jacques Lucke deleted branch linear-allocator-unordered-list 2024-02-28 22:22:34 +01:00
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 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#118774
No description provided.