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

niti: cache anchor_to and some other optimizations #2852

Merged
merged 12 commits into from
Aug 23, 2024

Conversation

privat
Copy link
Member

@privat privat commented Aug 21, 2024

Some low-hanging-fruit optimizations in the interpreter. Most are simple caching.

The improvements are impressive for microbenches

$ ./difftime.sh nit ./nit fib.nit 28
+ nit fib.nit 28
317811
User time: 6.19
+ ./nit fib.nit 28
317811
User time: 2.08
Gain: 66.397

But less impressive for more complex programs

$ ./difftime.sh nit ./nit nit.nit ../tests/base_simple3.nit
+ nit nit.nit ../tests/base_simple3.nit
1
2
3
4
5
6
7
8
9
10
User time: 2.42
+ ./nit nit.nit ../tests/base_simple3.nit
1
2
3
4
5
6
7
8
9
10
User time: 1.96
Gain: 19.008

The gain is non negligible

before:

```
$ time nit  fib.nit 29
514229
real	0m9,830s
user	0m9,706s
sys	0m0,120s
```

after:

```
$ time ./nit  fib.nit 29
514229
real	0m5,311s
user	0m5,191s
sys	0m0,115s
```

Signed-off-by: Jean Privat <[email protected]>
Copy link

github-actions bot commented Aug 21, 2024

Test Results

    67 files     337 suites   17m 56s ⏱️
14 236 tests 13 689 ✅ 547 💤 0 ❌
14 627 runs  14 060 ✅ 567 💤 0 ❌

Results for commit f67dd0f.

♻️ This comment has been updated with latest results.

@privat privat changed the title niti: cache anchor_to niti: cache anchor_to and some other optimizations Aug 22, 2024
@privat
Copy link
Member Author

privat commented Aug 22, 2024

I stop the series here. Other changes are more intrusive and might be done in other PRs

@privat privat merged commit 8136740 into nitlang:master Aug 23, 2024
21 checks passed
privat added a commit that referenced this pull request Aug 26, 2024
…rivat/test_nitin

#2852 shown that nitin is a good program to test the interpreter. So beef up the tests!
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.

1 participant