Skip to content

improve patch perf #9

@obust

Description

@obust

looking at the benchmark

name met (ms) iters throughput (GElems/s) min (ms) mean (ms) max (ms) duration (ms)
diff_append_row[1000+1] 2.533135881104034 471 0.00039516237856286157 2.533135881104034 2.533135881104034 2.533135881104034 1193.107
diff_append_row[1000+10] 2.6789449339207048 454 0.00037701409506832946 2.6789449339207048 2.6789449339207048 2.6789449339207048 1216.241
diff_append_row[1000+100] 3.3380165745856356 362 0.00032953700960473766 3.338016574585635 3.3380165745856356 3.338016574585635 1208.362
diff_append_row[1000+1000] 11.11425 100 0.00017994916436106802 11.11425 11.11425 11.11425 1111.425

looking at diff_append_row[1000+N]:

  • diffing 1000 rows takes ~2.5ms
  • the more we append rows the more the timing increase. that is because each Patch is copying the dst element Patch.__init__(out self, owned action: String, path: List[Int], value: Element):. Ideally the Patch should just take a reference (Pointer) to the destination element to avoid copy. I could confirm that diff_append_row[1000+1000] goes to ~2.5ms when using
    • var value: Optional[UnsafePointer[Element]]: could run this and diff_append_row[1000+1000] gets to ~2.5ms. However tests crash. I think because some referenced elements are moving underneath the pointer.
    • var value: Optional[Pointer[Element, origin]]: could not get the origin to propagate to ListPatch

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