-
Notifications
You must be signed in to change notification settings - Fork 4
ALL_CAPS are now constants. Changed/shared recursive function environment. Fixed bug with macro environment. Added pprof. #102
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
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
113c299
ALL_CAPS are now constants - manual tested for all but recursion whic…
ldemailly ce37333
Add comments, rename IsConstantIdentifier-> more go style Constant()
ldemailly 05bf8b9
fix mixup between macro env and eval state env; add tests for constan…
ldemailly ac2a440
fix foo++ returning foo+1 instead of foo (only return error if FOO++)
ldemailly fcb5f1f
fix usage of N in pi.gr; log setting constant as info
ldemailly 43f20dc
big change in recursion environment, see comments and https://github.…
ldemailly 6be89df
add test for presence/absence of == Macro ==> step
ldemailly 3973284
linters
ldemailly efe013f
Adding examples showing huge perf regression
ldemailly 542cc2d
adding pprof option to main() and found the issue with recursion not …
ldemailly b0260c1
unrelated fix for wasm/web share: preserve the tabs
ldemailly 55a8a1e
Merge branch 'main' into constants
ldemailly 60a4899
replace 2 log.Fatalf by return log.FErrf for consistency
ldemailly 9b8635a
Apply suggestions from code review
ldemailly 2d03d45
add missing import
ldemailly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // Keep 0.24 syntax for perf comparison. Used to detect a serious performance regression | ||
| // during https://github.com/grol-io/grol/pull/102 | ||
| f = func(i, n, prod) { | ||
| if (i == n+1) { | ||
| return 1. / (prod * prod * n) | ||
| } | ||
| f(i+1, n, prod*(1-1./(2*i))) | ||
| } | ||
| n = 100000 | ||
| f(1, n, 1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could add a map[type]func(Node) Object
Then you create one method per type
So evalInternal method will then simply check if there is a func, then call it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder, I had skipped that one earlier
If it worked, we'd need to profile it (good that there is
-profile-cpunow) but I don't think it'd help because you'd need to cast anyway inside each small function (but try and let me know :) ?)Note that for other types, like token.Type or object.Type an array lookup would be good, as the type fit into uint8 which eliminates bound checks, and I had started something like that in #93