Skip to content

Lots of allocation when parsing float numbers #17

@BambOoxX

Description

@BambOoxX

Hello, I have more a question than a real issue.

When parsing strings composed of multiple float numbers, I get a lot of allocations I do not understand.
The following example

using Scanf, BenchmarkTools
s = "1.39086e+00  1.39391e+00  1.39544e+00  1.39239e+00  1.41680e+00  1.41375e+00"
@btime @scanf($s, "%13e%13e%13e%13e%13e%13e", Float32, Float32, Float32, Float32, Float32, Float32)

produces

6.560 μs (35 allocations: 1.88 KiB)

I can't really make sense of all these allocations. Could you please help me understand where they come from ?
For large datasets of the same kind, scanf becomes the bottleneck due to the number of allocations performed there.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions