Skip to content

Fix performance impact of $&parse changes #267

@jpco

Description

@jpco

#263 changed how the $&parse primitive works, replacing some behavior built into the primitive with es script. This should have been a mostly transparent change, but it did have some negative impact on performance, especially while running scripts and parse-heavy workloads (such as the shell's tests).

To a small extent this is inherent when moving any behavior from built-in C to es, but to a pretty large extent this is because the input logic was in some ways "de-optimized" to help with the migration. Some examples of things that could be made better:

  • Most parsing-related state is now freed and reallocated with each parse, so the number of allocations has risen by quite a bit
  • Whereas scripts were previously read in 4K chunks, now they are read-and-seeked line-at-a-time, increasing syscall counts by a fair amount
  • Some cases, especially when parsing strings, now go through an entire extra parse-and-read cycle before producing an EOF when they don't need to

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