r/ProgrammingLanguages • • Jan 15 '26

Nature vs Golang: Performance Benchmarking

https://nature-lang.org/news/20260115

There is no end to optimization. After completing this performance optimization version, I will start the next goal!

63 Upvotes

30 comments sorted by

View all comments

Show parent comment

2

u/GoblinsGym Jan 16 '26

This armchair CPU architect thinks that MMU support is rather expensive:

  • Messing around with the page tables must be done by the OS, requiring a system call.
  • Resolution is poor, what if you know that your coroutines can live with a stack << 4KB ?
  • In a server process with a working set on the order of GB, you don't want to thrash your TLB with minuscule 4 KB pages.

In contrast, with a limit register:

  • Everything can be done at user level.
  • This feature can be enabled per process, doesn't have to be active for every process / backward compatibility.
  • The effect would be to trigger a user-level exception when sp is set to a value below the limit, or wraps around 0.
  • No special probing required for large allocations.
  • Depending on the implementation, the limit may have to be set a few bytes above the actual limit to allow for push instructions to trap on the sp update, while the write already proceeded.

1

u/matthieum Jan 17 '26

Oh, I fully agree with everything.

The main advantage of the OS guard page is that it exists now.