- 26 Apr, 2020 5 commits
-
-
Eric Myhre authored
Int is now basically all common stuff. Now I'm really gonna quit. Interestingly, the total line count isn't going down very fast. 108 insertions, 165 deletions, according to the git diff stat. Evidentally the overhead of things opting into this is darn near the amount of lines saved in many cases.
-
Eric Myhre authored
Decided a basic bool property for this is probably fine after all. (For quite a while I'd been wondering if we'd end up with an enum of variants that are more or less semantic siblings of Repr, but it still hasn't happened, and thus it's now seeming quite unlikely.)
-
Eric Myhre authored
This one turns out to be different betweens scalars and recursives, if in a small (and fortunately consistent) way.
-
Eric Myhre authored
Some are easier than others. I'm starting to evolve a (still ad-hoc) naming convention for the extracted functions in order to provide some cues for how common you can expect the thing to be. Scalars have a lot more commonizable stuff than non-scalars, for example.
-
Eric Myhre authored
-
- 24 Apr, 2020 2 commits
-
-
Eric Myhre authored
-
Eric Myhre authored
Required a few fixes to the stringjoin struct representation (namely, AssembleKey initialization hadn't been exercised yet).
-
- 19 Apr, 2020 9 commits
-
-
Eric Myhre authored
With use of pointer here: overall benchmarks if marshalling or suchlike are perfectly reasonable and on par with the basicnode implementations (the biggest cost is getting iterators, which is similar in each). With the typo causing a copy and another heap escape: that extra alloc causes a zonking 10% slowdown on selected marshalling benchmark. (I'm using benchmarks on the 'realgen' package. MapNStrMap3StrInt can be exercised now -- isn't that neat? Suppose I'll commit that next.)
-
Eric Myhre authored
Reset methods on assemblers were needed for this. So far, we'd gotten along without these, because structs happen to not reuse assemblers between fields. But we definitely do need them in general. It would've been possible to avoid having the reset methods on scalars, but it doesn't seem work the effort; it would save a line of GSLOC, but make absolutely no other practical difference, and also make the templates a fair sight more complicated. So meh to that.
-
Eric Myhre authored
Also, hej: now recursive maps can be compiled! (Previously they were stymied simply because the maybe emission hadn't been pasted in.)
-
Eric Myhre authored
Through compilation, at least. No functional tests yet written. Bunch of small fixes for maybe pointers. (Somehow I had gotten their embedding in the entry struct wrong, and that kinda splashed all over.) The refactor of method names 'construct'->'fromString' also made a bunch of the generated map code line up, since it was already written to target that convention. Then it's just the matter of adding the tests that compile. And so far so good: combos of nullable values, not nullable, and maybe with or without use of pointers all appear to compile!
-
Eric Myhre authored
This seems to be getting pretty close: the only compile errors left are about not finding "fromString" methods for key reification... which is of course sensible, because that's not what those methods have been called yet in the cases where they've shown up; and they also haven't been placed on type-level styles yet. So the next commit will be a little detour to touch over those methods formerly known as "construct" and update them a bit to this pattern.
-
Eric Myhre authored
Fixes many issues with maybes. Some minor typo-scale stuff; some pretty consequential. What to do about speciated lookup methods still has big honking questions on it: returning a maybe there if you didn't already have data in that format can be *not cheap*. Figuring out the best DX there is gonna be interesting. Making progress on how to handle keys, but slow. Complex keys are... well, really complex. So far I've learned several things that *won't* work, which is fun. It's looking unlikely that having a KeyAssembler type at all is actually going to be a good idea.
-
Eric Myhre authored
Complex keys are a behemoth of a feature, and it's gonna take substantial effort to sort all of that out.
-
Eric Myhre authored
(Ain't that a lovely bunch of conditions?) Previous comment in here missed an important case.
-
Eric Myhre authored
-
- 16 Apr, 2020 1 commit
-
-
Eric Myhre authored
If you've been following along for a while now, you don't need to see the benchmarks to know what's coming. The long story short is: allocations are the root of all evil, and we got rid of some, and now things are significantly faster. Here's the numbers: basicnode (just for a baseline to compare to): ``` BenchmarkMapStrInt_3n_AssembleStandard-8 1988986 588 ns/op 520 B/op 8 allocs/op BenchmarkMapStrInt_3n_AssembleEntry-8 2158921 559 ns/op 520 B/op 8 allocs/op BenchmarkMapStrInt_3n_Iteration-8 19679841 67.0 ns/op 16 B/op 1 allocs/op BenchmarkSpec_Marshal_Map3StrInt-8 1377094 870 ns/op 544 B/op 7 allocs/op BenchmarkSpec_Marshal_Map3StrInt_CodecNull-8 4560031 278 ns/op 176 B/op 3 allocs/op BenchmarkSpec_Unmarshal_Map3StrInt-8 368763 3239 ns/op 1608 B/op 32 allocs/op ``` realgen, previously, using fcb: ``` BenchmarkMapStrInt_3n_AssembleStandard-8 4293072 278 ns/op 208 B/op 5 allocs/op BenchmarkMapStrInt_3n_AssembleEntry-8 4643892 259 ns/op 208 B/op 5 allocs/op BenchmarkMapStrInt_3n_Iteration-8 20307603 59.9 ns/op 16 B/op 1 allocs/op BenchmarkSpec_Marshal_Map3StrInt-8 1346115 913 ns/op 544 B/op 7 allocs/op BenchmarkSpec_Marshal_Map3StrInt_CodecNull-8 4606304 256 ns/op 176 B/op 3 allocs/op BenchmarkSpec_Unmarshal_Map3StrInt-8 425662 2793 ns/op 1160 B/op 27 allocs/op ``` realgen, new, improved: ``` BenchmarkMapStrInt_3n_AssembleStandard-8 6138765 183 ns/op 129 B/op 3 allocs/op BenchmarkMapStrInt_3n_AssembleEntry-8 7276795 176 ns/op 129 B/op 3 allocs/op BenchmarkMapStrInt_3n_Iteration-8 19593212 67.2 ns/op 16 B/op 1 allocs/op BenchmarkSpec_Marshal_Map3StrInt-8 1309916 912 ns/op 544 B/op 7 allocs/op BenchmarkSpec_Marshal_Map3StrInt_CodecNull-8 4579935 257 ns/op 176 B/op 3 allocs/op BenchmarkSpec_Unmarshal_Map3StrInt-8 465195 2599 ns/op 1080 B/op 25 allocs/op ``` So! About 150% improvement on assembly between gen with fcb and our new-improved no-callback system. And about 321% improvement in total now for codegen structs over the basicnode map. That's the kind of ratio I was looking for :) As with all of these measurements: these will also get much bigger on bigger corpuses. Some of the improvements here are O(n) -> O(1), and some apply even more heartily in deeper trees, etc. But it's telling that even on very small corpuses, the impact is already huge.
-
- 07 Apr, 2020 1 commit
-
-
Eric Myhre authored
Some touches to ImplicitValue came along for the ride, but aren't exercised yet. Tests are getting unwieldy. I think something must be done about this before proceding much further or it's going to start resulting in increasingly significant velocity loss.
-
- 06 Apr, 2020 2 commits
-
-
Eric Myhre authored
-
Eric Myhre authored
Still have a lot of uncertainty to resolve around nullable and optional in general. But writing that up elsewhere -- trying to treat it from the spec angle without getting the implementation too mixed up in it.
-
- 01 Apr, 2020 8 commits
-
-
Eric Myhre authored
I'm almost a little staggered. We've got structures with maybes both using pointers and not, and everything seems fine. A few fixes were necessary, but they were mostly "d'oh" grade. (The finishCallback logic is a bit hairy, but appears correct now.) More cases for more variations in presence coming up next.
-
Eric Myhre authored
Easier than previous commit message seemed to think. Since we already have finishCallback functions in play in any scene where maybes can also be in play, we can just make those responsible for copying out a pointer from the child assembler to the parent value. That makes the child assembler able to create a new value late in its lifecycle and still expect it can land in a proper home. Tests needed badly; this is *oodles* of edge cases. Unrelated fix needed first. (Might make that elsewhere and rebase this to include that, to reduce the carnage ever so slightly.)
-
Eric Myhre authored
Fix many issues with maybes; adjunct config for if maybe is implemented using a pointer; attempt the finishCallback system for reusable child assemblers. This... almost appears to be on a dang nice track. Except one fairly critical thing. It doesn't work correctly if your maybe IS implemented as containing a pointer. Because that pointer starts life as nil in the parent structure. And that's hard to fix. We can't have a pointer to a pointer in the assembler; that'd cause the type bifructation we've been trying to avoid. (We can give up and do that of course; it would be correct. Just... more code and larger final assembly size. And if we did this, a lot of this diff would be rewritten.) We could have the parent structure allocate a blank of the field, and put a pointer to it in the maybe and also in the child assembler. Except... this is a wasted allocation if it turns out to be null. Rock and hard place detected in a paired configuration. Might have to back out of this approach entirely. Not sure.
-
Eric Myhre authored
We'll see how this works out.
-
Eric Myhre authored
-
Eric Myhre authored
Lots of tasty bitshuffling in this commit. Remaining: creating, embedding, and returning child value assemblers. This might involve a full type per field: doing so would be direct, have pretty excellent verbosity in debugging symbols, and pointers back to parent suffer no interface indirection; overall, it's probably going to have the fastest results. However, it would also mean: we can't save resident memory size if we have more than one field in a struct that has the same type; and we we can't avoid increasing binary size if the same types are used as fields in several places. Going to pause to think about this for a while.
-
Eric Myhre authored
This cleans up a lot of stuff and reduces the amount of boilerplate content that's just generating monomorphizing error method stubs. The nodeGenerator mixins now also use the node mixins. I don't know why I failed to do that from the start; I certainly meant to. It results in shorter generated code, and the compiler turns it into identical assembly.
-
Eric Myhre authored
Compiles and runs; but the results don't. Some small issues; some big issues. Just needed a checkpoint. It's feeling like it's time to deal with breaking down the assembler generators in the same way we did for all the node components, which is going to be kind of a big shakeup.
-
- 29 Mar, 2020 1 commit
-
-
Eric Myhre authored
I *think* the notes on Maybes are now oscillating increasingly closely around a consistent centroid. But getting here has been a one heck of a noodle-scratcher.
-