Skip to content

[Filesystem] Cache more calls in Path #58890

Closed
@Toflar

Description

@Toflar

Description

In our project, we use Path::makeRelative() quite extensively. In 90% of all cases $basePath is identical. But still, Symfony calls self::split($basePath) on this on every single call wasting lots of resources.

We already cache the results of canonicalize() in $buffer with some $bufferSize "magic". Before creating a PR, I wanted to ask which way we should go here. There's actually a lot that could be cached in this utility class. Who defines which methods qualify for a static buffer?

And is that buffer handling even the correct approach? Should't we have a static reset() or so? Should the existing filesystem service call Path::reset() then?

Wdyt?

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)Filesystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions