Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce memory usage of Scope.t #67

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

tatchi
Copy link
Contributor

@tatchi tatchi commented Oct 10, 2024

This is my take at implementing your suggestion to reduce Scope.t memory usage

@tatchi tatchi force-pushed the reduce-mem-usage-scope branch from 09ca2dd to c94c074 Compare October 10, 2024 19:16
@@ -845,15 +919,19 @@ module Scope = struct
call it if there is an instrumentation backend. *)
let[@inline] add_attrs (scope : t) (attrs : unit -> key_value list) : unit =
if Collector.has_backend () then
scope.attrs <- List.rev_append (attrs ()) scope.attrs
scope.items <-
List.fold_left (fun acc attr -> Attr (attr, acc)) scope.items (attrs ())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think about the order; does it matter ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should matter, no :)

@tatchi tatchi force-pushed the reduce-mem-usage-scope branch from c94c074 to ac1a27e Compare October 10, 2024 19:22
Copy link
Member

@c-cube c-cube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, that's exactly what I had in mind!

@@ -845,15 +919,19 @@ module Scope = struct
call it if there is an instrumentation backend. *)
let[@inline] add_attrs (scope : t) (attrs : unit -> key_value list) : unit =
if Collector.has_backend () then
scope.attrs <- List.rev_append (attrs ()) scope.attrs
scope.items <-
List.fold_left (fun acc attr -> Attr (attr, acc)) scope.items (attrs ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should matter, no :)

@c-cube c-cube merged commit 974ce75 into imandra-ai:main Oct 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants