Skip to content

Poor performance when extruding translate groups #932

@baryluk

Description

@baryluk

System information

  • solvespace from master @ 7795b0b
  • Debian testing, amd64
  • gcc 10.2.1

Details

I was doing a small project for fun, and went a bit over board with some holes in a sheet metal, to the point where it takes about 4 minutes to render do anything useful.

I used an extrusion of translate of translate to generate a 2D pattern.

case-vents.slvs.gz (~20MB unpacked, can take few minutes to open, be warned).

Looking at perf top, and a bit of code in Generate, it looks like the major culprit it CopyEntity, which triggers a copy of Entity classes. The base class (EntityBase) has two std::string fields str and font, which I believe should not be in the EntityBase, as most of the entities doesn't use these fields actually. Because they are there directly, each construction and destruction, will be called every time any entity is copied (I don't know if it will also trigger malloc/free, which could be even worse). In perf I see ~basic_string<...>, using about 90% of the CPU. Platform::Path file from EntityBase, also shows quite a lot in perf top. Other option is to use reference counting for strings maybe. Not sure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions