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

AST + runtime memoizer #330

Merged
merged 7 commits into from
Feb 26, 2024
Merged

AST + runtime memoizer #330

merged 7 commits into from
Feb 26, 2024

Conversation

Mzack9999
Copy link
Member

@Mzack9999 Mzack9999 commented Feb 8, 2024

Closes #345

@Mzack9999 Mzack9999 linked an issue Feb 21, 2024 that may be closed by this pull request
@Mzack9999 Mzack9999 marked this pull request as ready for review February 21, 2024 21:09
@Mzack9999 Mzack9999 added the Type: Enhancement Most issues will probably ask for additions or changes. label Feb 21, 2024
@Mzack9999 Mzack9999 self-assigned this Feb 21, 2024
Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

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

lgtm !

seems like it might create empty variable blocks sometimes

var ()

func Test(a string, b string) string {

	h := hash("Test", a, b)
	v, _, _ := cache.Do(h, func() (interface{}, error) {

		vresultTest := &resultTest{}
		vresultTest.result0 = tests.Test(a, b)
		return vresultTest, nil

	})

	vresultTest := v.(*resultTest)

	return vresultTest.result0

}

but i believe it was never intended to be fully automated as memoized functions need to be replaced manually in existing code

@tarunKoyalwar tarunKoyalwar merged commit ef2665f into main Feb 26, 2024
7 checks passed
@tarunKoyalwar tarunKoyalwar deleted the feat-memoizer branch February 26, 2024 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic memoizer via AST parsing and code generation
2 participants