Neat 0.5.1: Make related_post_gen Fast Hopefully
We're not supposed to add optimizations directly for the benchmark. So have Neat 0.5.1, with a whole bunch of generic performance optimizations added for "no particular reason."
But first:
Semi-big language change: &var
now requires mut
.
You can no longer take the address of any variable not declared mut
. This has been an open problem for a long time: the refcounter absolutely relies on mut
to tell it if a variable is allowed to change. if you can just take a pointer to a variable and assign to it, that bypasses all protections. Since you can just make (almost) any variable mut
this should not present any issues.
This used to be an issue for the refcounter, but as of this release neat will engage in more intense optimization of non-mut
variables. As a result, if you somehow manage to mutate a non-mut
variable, your changes may straight up not be visible in other parts of the code.
I'll take this opportunity to draw your attention to a gaping hole in the language. You can call struct methods on variables that are not mut
. These methods can then mutate variables in the struct. If you do this, you will basically break everything. The long-term fix to this is to annotate methods with mut
and only allow mut
methods to mutate this
. The short-term fix is to be careful with what methods you call.
__moveEmplace
, __copyEmplace
These are mainly useful for macro writers. __moveEmplace(source, dest)
will write source
into dest
without any refcounting. __copyEmplace(source, dest)
will write a copy of source
into dest
. Note that neither of them refcount dest
, so they should be used when initializing uninitialized variables and arrays. Use __copyEmplace
if you wish to access source
after the call; with __moveEmplace
, this is illegitimate code.
Loop speedups
for (value in array)
type loops no longer produce pointless bounds checks. This is, I want to emphasize again, a fully generic optimization that has absolutely nothing to do with any particular benchmark that Neat did absolutely terribly on.
And some small stuff
- Fix LLVM backend spacer alignment.
- Implement
a %= b;
. - Add std.algorithm.zip.
- Vectors are now index assignable.
- Add ArraySource, ArraySink
- Add Time.year, month, etc. Add
Time.monotonic
for benchmarking.